Update SDK dependency (#177)
* Update dependencies * Update dependencies * Update dependencies * Update dependencies --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
506d1afdc2
commit
c7effac5c7
62 changed files with 382 additions and 382 deletions
49
go.mod
49
go.mod
|
|
@ -12,20 +12,20 @@ require (
|
|||
github.com/hashicorp/terraform-plugin-log v0.9.0
|
||||
github.com/hashicorp/terraform-plugin-testing v1.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.7.3
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.9.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.8.0
|
||||
golang.org/x/mod v0.14.0
|
||||
)
|
||||
|
||||
|
|
@ -36,14 +36,14 @@ require (
|
|||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/cloudflare/circl v1.3.3 // indirect
|
||||
github.com/fatih/color v1.16.0 // indirect
|
||||
github.com/go-logr/logr v1.3.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0 // indirect
|
||||
github.com/go-logr/logr v1.4.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
|
||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.2 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-plugin v1.6.0 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
|
|
@ -66,24 +66,23 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.7.0
|
||||
github.com/stretchr/testify v1.8.3 // indirect
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.8.0
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/zclconf/go-cty v1.14.1 // indirect
|
||||
golang.org/x/crypto v0.16.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/oauth2 v0.14.0 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/oauth2 v0.15.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
|
||||
google.golang.org/grpc v1.60.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
|
||||
google.golang.org/grpc v1.60.1 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
k8s.io/apimachinery v0.28.4 // indirect
|
||||
k8s.io/apimachinery v0.29.0 // indirect
|
||||
k8s.io/klog/v2 v2.110.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect
|
||||
)
|
||||
|
|
|
|||
99
go.sum
99
go.sum
|
|
@ -35,12 +35,13 @@ github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+
|
|||
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||
github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY=
|
||||
github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0=
|
||||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
|
||||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/logr v1.4.0 h1:wx+BduGRXjIL6VPeeb7DRX+ii7sR/ch8DlRifHR589o=
|
||||
github.com/go-logr/logr v1.4.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0 h1:UGKbA/IPjtS6zLcdB7i5TyACMgSbOTiR8qzXgw8HWQU=
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
|
@ -65,8 +66,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
|
|||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
|
||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
|
||||
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
|
||||
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I=
|
||||
github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A=
|
||||
|
|
@ -153,40 +154,40 @@ github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJC
|
|||
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.7.3 h1:oxLY44Vuyn7+lcKBZDFGbc2YSjnw43PbuiATBL3aq+I=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.7.3/go.mod h1:5hA/nSktcp/BiFaRyMIV6E/1d/i7cieLNE5XzWPrICo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.7.0 h1:6q5vqrc1Rov0l64eWjK0rC6pvMIuJd6RotPPc1ZQYGo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.7.0/go.mod h1:IPMHLk1W1+u2wnqllvJnOmcP10auT+572iglpiQo3H8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.6.0 h1:n7ONZlfyWk/D10mWMT/j25kuV6ARgyFd3vIZB3kgrIo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.6.0/go.mod h1:1hRYJV33kFW/WaJuiFZWP7Z5FHhf6TnVc1equhFhMnA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.7.0 h1:atkoIAIk3ciXRfhppRW6idhvyXBaGHcOYw9koWkfrFU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.7.0/go.mod h1:Lvtm8yykjbBaa3JPpy5cTDgJ7oZ26PVROxNSwfwa87w=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.7.0 h1:adCOJQTd2do0W5AjU0thALEvid0KMJw52ZsSwj2k4FM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.7.0/go.mod h1:dbXL5eQN7p0nXeYJXny2q10L5aHSFWdkC0CSLF5ZZO0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.7.0 h1:7D5pLs7tIGM0lU2W+QU5E3uBQ+xfRVnrcfLk0+2dUhQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.7.0/go.mod h1:0Zk3F5NExI1F1eAvPQLnn0FWDXMWWbggdZyWPriBenA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.7.0 h1:XeCCtuoAiRV/PS1NIFlA+YUCdOPCsYTNbqGRbk4uruU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.7.0/go.mod h1:xw+amLVIb7SXanyXOnYjdLr7tE3r/fVeHeZ73qo529s=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.7.0 h1:PMNIbFP76ytjBAR9Qdj71Pn39+b3ePZrIJG0M1vqGOQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.7.0/go.mod h1:ZbJqlT9Fgf0lgaoNQHWvpNMh5OPAtd/GTPeCAFlhXVo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.7.0 h1:yffzRXujoXEkZyVZhaQk1xK4sRu7SLMXARTvFviCI94=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.7.0/go.mod h1:fyJ/+JOJztGfcJc51mNTGMx8Hwy1aDxzFgOv6bM6k3o=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.7.0 h1:34HtZO3QDbrLngDlQAd3dAJ50Ms4+ciuMIBU7eHHcSU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.7.0/go.mod h1:MU2lAHKUs752i4Bpw3Lb+9jc54D86zy87WfYRdianEA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.8.0 h1:EDKTjIK/hEP50eBxo4lG0WV6oExkPripSX0NtgTagEE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.8.0/go.mod h1:sHurHXxHGneHkWG6vE8PX9wr56ft02GO0Rj1tZzPiKQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.7.0 h1:vL+2hc4xwtW0xM/9gURwemZSfEc0Ko0JNT/L2IvLIAk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.7.0/go.mod h1:A1V3v3UYbKh/hK0U5a2nJWUUbdTn8EBO4J5ng9ssXcM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.7.0 h1:daqibtU7Co0ahWcDoHYSZQS3sJXbX/j+9RnSizWGUnQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.7.0/go.mod h1:CMOusS/x6MgyejhOMU+/E6rrWC9pLxc5MWngHoXS+n0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.6.0 h1:fIwq2GkiRCYeesTa4bQeGQOKE3c8qSZgFPDw7fGFFuU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.6.0/go.mod h1:mGGsvpITagchv9INzoUNesiq1Pm7r+eWX7omnb+ljE0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.4.0 h1:7FN+QTtzxJUCdtittbGdZsEAyWp1Ktyj3iEZOKSb49k=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.4.0/go.mod h1:bfvfev2KOoxIlxcK3KQW7cIcMmskD3T/d8gnIZIJgAQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.7.0 h1:VEhrtgSyN/VfwG8K+f1m/DW0ZBgGGCdvQGmWRHhlEbQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.7.0/go.mod h1:RkVZFbLyRxxCY3vUMtGDPns2K3qQKKl+nK95Hb3PtNw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.8.0 h1:wB/3AHZu3u8hY+DN7sA+zm/zB5UK7T3Cdzu6c3IMa2E=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.8.0/go.mod h1:nYxNcZuHaXzZXNES9lriPtt6su+N599yYG96palrxVo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.7.0 h1:vwuQfDuX83IeLnNPA+j09On4sITvdcXK3pogkANrBzA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.7.0/go.mod h1:IRNGsJZhuf0s+9Ta4wIhDt3t8mOwKcZ2YeHC0CChigQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.8.0 h1:Ax309bGX7WyQIfEij70wFpWq+3BVZQjg3wmE2rZBCmE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.8.0/go.mod h1:Lvtm8yykjbBaa3JPpy5cTDgJ7oZ26PVROxNSwfwa87w=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.8.0 h1:M7E84yOLTjm6E8WxySY7+BhshYmDcencXUm35c1EJbg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.8.0/go.mod h1:TeBxxgigVPSb5N+ZD1x9DQq7Ecg7d1QzlCSeGYKj4Hk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.8.0 h1:AEGohHqEWL1du8X90t+emociNBBOnpMKrxHgl4ZFGOc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.8.0/go.mod h1:9Ik8Xda7jcjleToKT5HTwtil0dk06/jyMzdE8mSFH6A=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.8.0 h1:BFJ16QVTcIgH+44Mr9WTf9t/BiSe3nkeOTL432WZ1fc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.8.0/go.mod h1:s/0vaynidfRj1lEBZGir2y0bI+V2UusCXd1i4IcRXqs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.0 h1:lIEOlT70QSuGGFEahPYn0irezjd7Nla8nD1lcHYa5Ys=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.0/go.mod h1:bK2+Zt7FAQr0TScpjqA+du8x3flLl6tuJ2Qmcmi9nv4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.8.0 h1:sJ+6/c/mOB+8YpmKHOwtIKhx14nirBBugy55vdljPes=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.8.0/go.mod h1:PhwlFqGD9eZu7Z5SPKxooolv9mJ3sAGNYD7zQTlmjWk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.8.0 h1:a+mOxxzEHdWsSzRHFLjPDlQeHgMOPIXbBpLdhKuLjjY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.8.0/go.mod h1:itYcfJL4g/hm8gEFN/3bfSvN+6ATSZZZvWV0DxDMqwE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.9.0 h1:J+9rnuo+O3S6UbZ7Q+Mgp3C3rS0ABBGMKTQ3A2OdPpo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.9.0/go.mod h1:o9OC4I+zxwGwXrTkkWzO8764VBrkNfacFox37VrBdvw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.8.0 h1:gJTRbv/b25f8x/4hfL0cS0XVvdbt+LgZ+pvTrJvZOf8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.8.0/go.mod h1:MmHXhvT44+OsV5gteDmTrdC18E5qswPAIZFwAn6Xxw0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.8.0 h1:HRcPfChQe4eZNU3TMGNMSpZ9VBIPjHnIrtpel2Ir+lg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.8.0/go.mod h1:LGogJZsnQDPZnR0uiNTwJ/GZ/CehyunpLdoMVQDoZFY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.0 h1:UfUEaXqiCxZ60pZlg/HEHWje5FzFUew/DFYxNRZG9tA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.0/go.mod h1:PhwMxGO0ePZdE4dotsMrasJ57+g9IBbW+5mit3zMcSI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.5.0 h1:DPOi0O7/OHeGOEzM8FGknIIDQBAtDP1WmFxz706a+qI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.5.0/go.mod h1:Bx+WDnBArRElIIpJnWGvXK1HzZXs2PfwWQ/PYCSC6Sc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.8.0 h1:jJife5UOLBsivfw4ajq2Eb2VIteetoN+S7+4TFTMiEA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.8.0/go.mod h1:RkVZFbLyRxxCY3vUMtGDPns2K3qQKKl+nK95Hb3PtNw=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
|
|
@ -218,10 +219,10 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
|||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
|
||||
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/oauth2 v0.14.0 h1:P0Vrf/2538nmC0H+pEQ3MNFRRnVR7RlqyVw+bvm26z0=
|
||||
golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ=
|
||||
golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
@ -271,10 +272,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
|||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
|
||||
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA=
|
||||
google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k=
|
||||
google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA=
|
||||
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
|
||||
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
|
|
@ -287,9 +288,9 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
|||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8=
|
||||
k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg=
|
||||
k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o=
|
||||
k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis=
|
||||
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
|
||||
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI=
|
||||
k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ func testAccCheckArgusDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
|
||||
got, err := r.client.CreateCredential(ctx, instanceId, projectId).Execute()
|
||||
got, err := r.client.CreateCredentials(ctx, instanceId, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -167,7 +167,7 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
tflog.Info(ctx, "Argus credential created")
|
||||
}
|
||||
|
||||
func mapFields(r *argus.Credential, model *Model) error {
|
||||
func mapFields(r *argus.Credentials, model *Model) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("response input is nil")
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ func (r *credentialResource) Read(ctx context.Context, req resource.ReadRequest,
|
|||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
userName := model.Username.ValueString()
|
||||
_, err := r.client.GetCredential(ctx, instanceId, projectId, userName).Execute()
|
||||
_, err := r.client.GetCredentials(ctx, instanceId, projectId, userName).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading credential", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -236,7 +236,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
userName := model.Username.ValueString()
|
||||
_, err := r.client.DeleteCredential(ctx, instanceId, projectId, userName).Execute()
|
||||
_, err := r.client.DeleteCredentials(ctx, instanceId, projectId, userName).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ import (
|
|||
func TestMapFields(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
input *argus.Credential
|
||||
input *argus.Credentials
|
||||
expected Model
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"ok",
|
||||
&argus.Credential{
|
||||
&argus.Credentials{
|
||||
Username: utils.Ptr("username"),
|
||||
Password: utils.Ptr("password"),
|
||||
},
|
||||
|
|
@ -39,7 +39,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"response_fields_nil_fail",
|
||||
&argus.Credential{
|
||||
&argus.Credentials{
|
||||
Password: nil,
|
||||
Username: nil,
|
||||
},
|
||||
|
|
@ -48,7 +48,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"no_resource_id",
|
||||
&argus.Credential{},
|
||||
&argus.Credentials{},
|
||||
Model{},
|
||||
false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ func (r *instanceResource) ImportState(ctx context.Context, req resource.ImportS
|
|||
tflog.Info(ctx, "Argus instance state imported")
|
||||
}
|
||||
|
||||
func mapFields(ctx context.Context, r *argus.InstanceResponse, model *Model) error {
|
||||
func mapFields(ctx context.Context, r *argus.GetInstanceResponse, model *Model) error {
|
||||
if r == nil {
|
||||
return fmt.Errorf("response input is nil")
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ func toUpdatePayload(model *Model) (*argus.UpdateInstancePayload, error) {
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetPlans(ctx, projectId).Execute()
|
||||
res, err := r.client.ListPlans(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ import (
|
|||
func TestMapFields(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
input *argus.InstanceResponse
|
||||
input *argus.GetInstanceResponse
|
||||
expected Model
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_ok",
|
||||
&argus.InstanceResponse{
|
||||
&argus.GetInstanceResponse{
|
||||
Id: utils.Ptr("iid"),
|
||||
},
|
||||
Model{
|
||||
|
|
@ -37,7 +37,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"values_ok",
|
||||
&argus.InstanceResponse{
|
||||
&argus.GetInstanceResponse{
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: utils.Ptr("name"),
|
||||
PlanName: utils.Ptr("plan1"),
|
||||
|
|
@ -57,7 +57,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"nullable_fields_ok",
|
||||
&argus.InstanceResponse{
|
||||
&argus.GetInstanceResponse{
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: nil,
|
||||
},
|
||||
|
|
@ -80,7 +80,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"no_resource_id",
|
||||
&argus.InstanceResponse{},
|
||||
&argus.GetInstanceResponse{},
|
||||
Model{},
|
||||
false,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ func testAccCheckDnsDestroy(s *terraform.State) error {
|
|||
zonesToDestroy = append(zonesToDestroy, zoneId)
|
||||
}
|
||||
|
||||
zonesResp, err := client.GetZones(ctx, testutil.ProjectId).ActiveEq(true).Execute()
|
||||
zonesResp, err := client.ListZones(ctx, testutil.ProjectId).ActiveEq(true).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting zonesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,12 +318,12 @@ func (r *recordSetResource) Update(ctx context.Context, req resource.UpdateReque
|
|||
return
|
||||
}
|
||||
// Update recordset
|
||||
_, err = r.client.UpdateRecordSet(ctx, projectId, zoneId, recordSetId).UpdateRecordSetPayload(*payload).Execute()
|
||||
_, err = r.client.PartialUpdateRecordSet(ctx, projectId, zoneId, recordSetId).PartialUpdateRecordSetPayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", err.Error())
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -465,7 +465,7 @@ func toCreatePayload(model *Model) (*dns.CreateRecordSetPayload, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model) (*dns.UpdateRecordSetPayload, error) {
|
||||
func toUpdatePayload(model *Model) (*dns.PartialUpdateRecordSetPayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
|
@ -481,7 +481,7 @@ func toUpdatePayload(model *Model) (*dns.UpdateRecordSetPayload, error) {
|
|||
})
|
||||
}
|
||||
|
||||
return &dns.UpdateRecordSetPayload{
|
||||
return &dns.PartialUpdateRecordSetPayload{
|
||||
Comment: conversion.StringValueToPointer(model.Comment),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Records: &records,
|
||||
|
|
|
|||
|
|
@ -231,13 +231,13 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
tests := []struct {
|
||||
description string
|
||||
input *Model
|
||||
expected *dns.UpdateRecordSetPayload
|
||||
expected *dns.PartialUpdateRecordSetPayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
&dns.UpdateRecordSetPayload{
|
||||
&dns.PartialUpdateRecordSetPayload{
|
||||
Records: &[]dns.RecordPayload{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -253,7 +253,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
}),
|
||||
TTL: types.Int64Value(1),
|
||||
},
|
||||
&dns.UpdateRecordSetPayload{
|
||||
&dns.PartialUpdateRecordSetPayload{
|
||||
Comment: utils.Ptr("comment"),
|
||||
Name: utils.Ptr("name"),
|
||||
Records: &[]dns.RecordPayload{
|
||||
|
|
@ -272,7 +272,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Records: types.ListValueMust(types.StringType, nil),
|
||||
TTL: types.Int64Value(2123456789),
|
||||
},
|
||||
&dns.UpdateRecordSetPayload{
|
||||
&dns.PartialUpdateRecordSetPayload{
|
||||
Comment: nil,
|
||||
Name: utils.Ptr(""),
|
||||
Records: &[]dns.RecordPayload{},
|
||||
|
|
|
|||
|
|
@ -398,12 +398,12 @@ func (r *zoneResource) Update(ctx context.Context, req resource.UpdateRequest, r
|
|||
return
|
||||
}
|
||||
// Update existing zone
|
||||
_, err = r.client.UpdateZone(ctx, projectId, zoneId).UpdateZonePayload(*payload).Execute()
|
||||
_, err = r.client.PartialUpdateZone(ctx, projectId, zoneId).PartialUpdateZonePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateZoneWaitHandler(ctx, r.client, projectId, zoneId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateZoneWaitHandler(ctx, r.client, projectId, zoneId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Zone update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -574,12 +574,12 @@ func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model) (*dns.UpdateZonePayload, error) {
|
||||
func toUpdatePayload(model *Model) (*dns.PartialUpdateZonePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
return &dns.UpdateZonePayload{
|
||||
return &dns.PartialUpdateZonePayload{
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
ContactEmail: conversion.StringValueToPointer(model.ContactEmail),
|
||||
Description: conversion.StringValueToPointer(model.Description),
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ func TestToPayloadUpdate(t *testing.T) {
|
|||
tests := []struct {
|
||||
description string
|
||||
input *Model
|
||||
expected *dns.UpdateZonePayload
|
||||
expected *dns.PartialUpdateZonePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
|
|
@ -289,7 +289,7 @@ func TestToPayloadUpdate(t *testing.T) {
|
|||
&Model{
|
||||
Name: types.StringValue("Name"),
|
||||
},
|
||||
&dns.UpdateZonePayload{
|
||||
&dns.PartialUpdateZonePayload{
|
||||
Name: utils.Ptr("Name"),
|
||||
},
|
||||
true,
|
||||
|
|
@ -315,7 +315,7 @@ func TestToPayloadUpdate(t *testing.T) {
|
|||
NegativeCache: types.Int64Value(-4534534),
|
||||
IsReverseZone: types.BoolValue(true),
|
||||
},
|
||||
&dns.UpdateZonePayload{
|
||||
&dns.PartialUpdateZonePayload{
|
||||
Name: utils.Ptr("Name"),
|
||||
Acl: utils.Ptr("Acl"),
|
||||
Description: utils.Ptr("Description"),
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ func (r *loadBalancerResource) Create(ctx context.Context, req resource.CreateRe
|
|||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
|
||||
// Get status of load balancer functionality
|
||||
statusResp, err := r.client.GetStatus(ctx, projectId).Execute()
|
||||
statusResp, err := r.client.GetServiceStatus(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error getting status of load balancer functionality", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -493,13 +493,13 @@ func (r *loadBalancerResource) Create(ctx context.Context, req resource.CreateRe
|
|||
|
||||
// If load balancer functionality is not enabled, enable it
|
||||
if *statusResp.Status != wait.FunctionalityStatusReady {
|
||||
_, err = r.client.EnableLoadBalancing(ctx, projectId).XRequestID(uuid.NewString()).Execute()
|
||||
_, err = r.client.EnableService(ctx, projectId).XRequestID(uuid.NewString()).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error enabling load balancer functionality", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
_, err := wait.EnableLoadBalancingWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
_, err := wait.EnableServiceWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error enabling load balancer functionality", fmt.Sprintf("Waiting for enablement: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ func testAccCheckLoadBalancerDestroy(_ *terraform.State) error {
|
|||
}
|
||||
|
||||
// Disabling loadbalancer functionality will delete all load balancers
|
||||
_, err = client.DisableLoadBalancingExecute(ctx, testutil.ProjectId)
|
||||
_, err = client.DisableServiceExecute(ctx, testutil.ProjectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("disabling loadbalancer functionality: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,12 +361,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -594,17 +594,17 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*logme.CreateIn
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*logme.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*logme.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &logme.UpdateInstancePayload{
|
||||
return &logme.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &logme.UpdateInstancePayload{
|
||||
return &logme.PartialUpdateInstancePayload{
|
||||
Parameters: &logme.InstanceParameters{
|
||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
||||
},
|
||||
|
|
@ -614,7 +614,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*logme.UpdateIn
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting LogMe offerings: %w", err)
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *logme.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting LogMe offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputParameters *parametersModel
|
||||
expected *logme.UpdateInstancePayload
|
||||
expected *logme.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
¶metersModel{},
|
||||
&logme.UpdateInstancePayload{
|
||||
&logme.PartialUpdateInstancePayload{
|
||||
Parameters: &logme.InstanceParameters{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -241,7 +241,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringValue("sgw"),
|
||||
},
|
||||
&logme.UpdateInstancePayload{
|
||||
&logme.PartialUpdateInstancePayload{
|
||||
Parameters: &logme.InstanceParameters{
|
||||
SgwAcl: utils.Ptr("sgw"),
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringNull(),
|
||||
},
|
||||
&logme.UpdateInstancePayload{
|
||||
&logme.PartialUpdateInstancePayload{
|
||||
Parameters: &logme.InstanceParameters{
|
||||
SgwAcl: nil,
|
||||
},
|
||||
|
|
@ -278,7 +278,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
PlanId: types.StringValue("plan"),
|
||||
},
|
||||
nil,
|
||||
&logme.UpdateInstancePayload{
|
||||
&logme.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ func testAccCheckLogMeDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,12 +361,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -594,17 +594,17 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*mariadb.Create
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*mariadb.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*mariadb.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &mariadb.UpdateInstancePayload{
|
||||
return &mariadb.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &mariadb.UpdateInstancePayload{
|
||||
return &mariadb.PartialUpdateInstancePayload{
|
||||
Parameters: &mariadb.InstanceParameters{
|
||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
||||
},
|
||||
|
|
@ -614,7 +614,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*mariadb.Update
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting MariaDB offerings: %w", err)
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *mariadb.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting MariaDB offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputParameters *parametersModel
|
||||
expected *mariadb.UpdateInstancePayload
|
||||
expected *mariadb.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
¶metersModel{},
|
||||
&mariadb.UpdateInstancePayload{
|
||||
&mariadb.PartialUpdateInstancePayload{
|
||||
Parameters: &mariadb.InstanceParameters{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -241,7 +241,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringValue("sgw"),
|
||||
},
|
||||
&mariadb.UpdateInstancePayload{
|
||||
&mariadb.PartialUpdateInstancePayload{
|
||||
Parameters: &mariadb.InstanceParameters{
|
||||
SgwAcl: utils.Ptr("sgw"),
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringNull(),
|
||||
},
|
||||
&mariadb.UpdateInstancePayload{
|
||||
&mariadb.PartialUpdateInstancePayload{
|
||||
Parameters: &mariadb.InstanceParameters{
|
||||
SgwAcl: nil,
|
||||
},
|
||||
|
|
@ -278,7 +278,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
PlanId: types.StringValue("plan"),
|
||||
},
|
||||
nil,
|
||||
&mariadb.UpdateInstancePayload{
|
||||
&mariadb.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ func testAccCheckMariaDBDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -669,14 +669,14 @@ func toCreatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}
|
||||
|
||||
return &mongodbflex.CreateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &acl,
|
||||
},
|
||||
BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule),
|
||||
FlavorId: conversion.StringValueToPointer(flavor.Id),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Replicas: conversion.Int64ValueToPointer(model.Replicas),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: conversion.StringValueToPointer(storage.Class),
|
||||
Size: conversion.Int64ValueToPointer(storage.Size),
|
||||
},
|
||||
|
|
@ -708,14 +708,14 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}
|
||||
|
||||
return &mongodbflex.PartialUpdateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &acl,
|
||||
},
|
||||
BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule),
|
||||
FlavorId: conversion.StringValueToPointer(flavor.Id),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Replicas: conversion.Int64ValueToPointer(model.Replicas),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: conversion.StringValueToPointer(storage.Class),
|
||||
Size: conversion.Int64ValueToPointer(storage.Size),
|
||||
},
|
||||
|
|
@ -725,7 +725,7 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}
|
||||
|
||||
type mongoDBFlexClient interface {
|
||||
GetFlavorsExecute(ctx context.Context, projectId string) (*mongodbflex.GetFlavorsResponse, error)
|
||||
ListFlavorsExecute(ctx context.Context, projectId string) (*mongodbflex.ListFlavorsResponse, error)
|
||||
}
|
||||
|
||||
func loadFlavorId(ctx context.Context, client mongoDBFlexClient, model *Model, flavor *flavorModel) error {
|
||||
|
|
@ -745,7 +745,7 @@ func loadFlavorId(ctx context.Context, client mongoDBFlexClient, model *Model, f
|
|||
}
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := client.GetFlavorsExecute(ctx, projectId)
|
||||
res, err := client.ListFlavorsExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("listing mongodbflex flavors: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ import (
|
|||
)
|
||||
|
||||
type mongoDBFlexClientMocked struct {
|
||||
returnError bool
|
||||
getFlavorsResp *mongodbflex.GetFlavorsResponse
|
||||
returnError bool
|
||||
listFlavorsResp *mongodbflex.ListFlavorsResponse
|
||||
}
|
||||
|
||||
func (c *mongoDBFlexClientMocked) GetFlavorsExecute(_ context.Context, _ string) (*mongodbflex.GetFlavorsResponse, error) {
|
||||
func (c *mongoDBFlexClientMocked) ListFlavorsExecute(_ context.Context, _ string) (*mongodbflex.ListFlavorsResponse, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("get flavors failed")
|
||||
}
|
||||
|
||||
return c.getFlavorsResp, nil
|
||||
return c.listFlavorsResp, nil
|
||||
}
|
||||
|
||||
func TestMapFields(t *testing.T) {
|
||||
|
|
@ -38,7 +38,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"default_values",
|
||||
&mongodbflex.GetInstanceResponse{
|
||||
Item: &mongodbflex.InstanceSingleInstance{},
|
||||
Item: &mongodbflex.Instance{},
|
||||
},
|
||||
&flavorModel{},
|
||||
&storageModel{},
|
||||
|
|
@ -71,8 +71,8 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&mongodbflex.GetInstanceResponse{
|
||||
Item: &mongodbflex.InstanceSingleInstance{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Item: &mongodbflex.Instance{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip1",
|
||||
"ip2",
|
||||
|
|
@ -80,7 +80,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
},
|
||||
BackupSchedule: utils.Ptr("schedule"),
|
||||
Flavor: &mongodbflex.InstanceFlavor{
|
||||
Flavor: &mongodbflex.Flavor{
|
||||
Cpu: utils.Ptr(int64(12)),
|
||||
Description: utils.Ptr("description"),
|
||||
Id: utils.Ptr("flavor_id"),
|
||||
|
|
@ -90,7 +90,7 @@ func TestMapFields(t *testing.T) {
|
|||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(78)),
|
||||
},
|
||||
|
|
@ -135,8 +135,8 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"simple_values_no_flavor_and_storage",
|
||||
&mongodbflex.GetInstanceResponse{
|
||||
Item: &mongodbflex.InstanceSingleInstance{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Item: &mongodbflex.Instance{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip1",
|
||||
"ip2",
|
||||
|
|
@ -257,10 +257,10 @@ func TestToCreatePayload(t *testing.T) {
|
|||
&storageModel{},
|
||||
&optionsModel{},
|
||||
&mongodbflex.CreateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{},
|
||||
},
|
||||
Storage: &mongodbflex.InstanceStorage{},
|
||||
Storage: &mongodbflex.Storage{},
|
||||
Options: &map[string]string{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -288,7 +288,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Type: types.StringValue("type"),
|
||||
},
|
||||
&mongodbflex.CreateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip_1",
|
||||
"ip_2",
|
||||
|
|
@ -298,7 +298,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
|
|
@ -329,7 +329,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Type: types.StringNull(),
|
||||
},
|
||||
&mongodbflex.CreateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"",
|
||||
},
|
||||
|
|
@ -338,7 +338,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
},
|
||||
|
|
@ -436,10 +436,10 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
&storageModel{},
|
||||
&optionsModel{},
|
||||
&mongodbflex.PartialUpdateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{},
|
||||
},
|
||||
Storage: &mongodbflex.InstanceStorage{},
|
||||
Storage: &mongodbflex.Storage{},
|
||||
Options: &map[string]string{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -467,7 +467,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Type: types.StringValue("type"),
|
||||
},
|
||||
&mongodbflex.PartialUpdateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip_1",
|
||||
"ip_2",
|
||||
|
|
@ -477,7 +477,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
|
|
@ -508,7 +508,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Type: types.StringNull(),
|
||||
},
|
||||
&mongodbflex.PartialUpdateInstancePayload{
|
||||
Acl: &mongodbflex.InstanceAcl{
|
||||
Acl: &mongodbflex.ACL{
|
||||
Items: &[]string{
|
||||
"",
|
||||
},
|
||||
|
|
@ -517,7 +517,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Storage: &mongodbflex.Storage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
},
|
||||
|
|
@ -600,7 +600,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
tests := []struct {
|
||||
description string
|
||||
inputFlavor *flavorModel
|
||||
mockedResp *mongodbflex.GetFlavorsResponse
|
||||
mockedResp *mongodbflex.ListFlavorsResponse
|
||||
expected *flavorModel
|
||||
getFlavorsFails bool
|
||||
isValid bool
|
||||
|
|
@ -611,7 +611,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&mongodbflex.GetFlavorsResponse{
|
||||
&mongodbflex.ListFlavorsResponse{
|
||||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
|
|
@ -636,7 +636,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&mongodbflex.GetFlavorsResponse{
|
||||
&mongodbflex.ListFlavorsResponse{
|
||||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
|
|
@ -667,7 +667,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&mongodbflex.GetFlavorsResponse{
|
||||
&mongodbflex.ListFlavorsResponse{
|
||||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
|
|
@ -696,7 +696,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&mongodbflex.GetFlavorsResponse{},
|
||||
&mongodbflex.ListFlavorsResponse{},
|
||||
&flavorModel{
|
||||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
|
|
@ -710,7 +710,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&mongodbflex.GetFlavorsResponse{},
|
||||
&mongodbflex.ListFlavorsResponse{},
|
||||
&flavorModel{
|
||||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
|
|
@ -722,8 +722,8 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
client := &mongoDBFlexClientMocked{
|
||||
returnError: tt.getFlavorsFails,
|
||||
getFlavorsResp: tt.mockedResp,
|
||||
returnError: tt.getFlavorsFails,
|
||||
listFlavorsResp: tt.mockedResp,
|
||||
}
|
||||
model := &Model{
|
||||
ProjectId: types.StringValue("pid"),
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ func testAccCheckMongoDBFlexDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Tag("").Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Tag("").Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"default_values",
|
||||
&mongodbflex.CreateUserResponse{
|
||||
Item: &mongodbflex.InstanceUser{
|
||||
Item: &mongodbflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Password: utils.Ptr(""),
|
||||
},
|
||||
|
|
@ -42,7 +42,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&mongodbflex.CreateUserResponse{
|
||||
Item: &mongodbflex.InstanceUser{
|
||||
Item: &mongodbflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
|
|
@ -77,7 +77,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"null_fields_and_int_conversions",
|
||||
&mongodbflex.CreateUserResponse{
|
||||
Item: &mongodbflex.InstanceUser{
|
||||
Item: &mongodbflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
|
|
@ -116,7 +116,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"no_resource_id",
|
||||
&mongodbflex.CreateUserResponse{
|
||||
Item: &mongodbflex.InstanceUser{},
|
||||
Item: &mongodbflex.User{},
|
||||
},
|
||||
Model{},
|
||||
false,
|
||||
|
|
@ -124,7 +124,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"no_password",
|
||||
&mongodbflex.CreateUserResponse{
|
||||
Item: &mongodbflex.InstanceUser{
|
||||
Item: &mongodbflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ func mapFields(bucketResp *objectstorage.GetBucketResponse, model *Model) error
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -305,7 +305,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ type objectStorageClientMocked struct {
|
|||
returnError bool
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ func (r *credentialResource) ImportState(ctx context.Context, req resource.Impor
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -313,7 +313,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ func readCredentials(ctx context.Context, model *Model, client *objectstorage.AP
|
|||
credentialsGroupId := model.CredentialsGroupId.ValueString()
|
||||
credentialId := model.CredentialId.ValueString()
|
||||
|
||||
credentialsGroupResp, err := client.GetAccessKeys(ctx, projectId).CredentialsGroup(credentialsGroupId).Execute()
|
||||
credentialsGroupResp, err := client.ListAccessKeys(ctx, projectId).CredentialsGroup(credentialsGroupId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting credentials groups: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ type objectStorageClientMocked struct {
|
|||
returnError bool
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -212,14 +212,14 @@ func TestReadCredentials(t *testing.T) {
|
|||
|
||||
tests := []struct {
|
||||
description string
|
||||
mockedResp *objectstorage.GetAccessKeysResponse
|
||||
mockedResp *objectstorage.ListAccessKeysResponse
|
||||
expected Model
|
||||
getCredentialsFails bool
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -247,7 +247,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -281,7 +281,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"expiration_timestamp_with_fractional_seconds",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -315,7 +315,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"empty_credentials",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{},
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -331,7 +331,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"non_matching_credential",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -351,7 +351,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"error_response",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("cid"),
|
||||
|
|
|
|||
|
|
@ -301,8 +301,8 @@ func mapCredentialsGroup(credentialsGroup objectstorage.CredentialsGroup, model
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
GetCredentialsGroupsExecute(ctx context.Context, projectId string) (*objectstorage.GetCredentialsGroupsResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
ListCredentialsGroupsExecute(ctx context.Context, projectId string) (*objectstorage.ListCredentialsGroupsResponse, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -310,7 +310,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@ func readCredentialsGroups(ctx context.Context, model *Model, client objectStora
|
|||
return fmt.Errorf("missing configuration: either name or credentials group id must be provided")
|
||||
}
|
||||
|
||||
credentialsGroupsResp, err := client.GetCredentialsGroupsExecute(ctx, model.ProjectId.ValueString())
|
||||
credentialsGroupsResp, err := client.ListCredentialsGroupsExecute(ctx, model.ProjectId.ValueString())
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting credentials groups: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,26 +12,26 @@ import (
|
|||
)
|
||||
|
||||
type objectStorageClientMocked struct {
|
||||
returnError bool
|
||||
getCredentialsGroupsResp *objectstorage.GetCredentialsGroupsResponse
|
||||
returnError bool
|
||||
listCredentialsGroupsResp *objectstorage.ListCredentialsGroupsResponse
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) GetCredentialsGroupsExecute(_ context.Context, _ string) (*objectstorage.GetCredentialsGroupsResponse, error) {
|
||||
func (c *objectStorageClientMocked) ListCredentialsGroupsExecute(_ context.Context, _ string) (*objectstorage.ListCredentialsGroupsResponse, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("get credentials groups failed")
|
||||
}
|
||||
|
||||
return c.getCredentialsGroupsResp, nil
|
||||
return c.listCredentialsGroupsResp, nil
|
||||
}
|
||||
|
||||
func TestMapFields(t *testing.T) {
|
||||
|
|
@ -161,14 +161,14 @@ func TestEnableProject(t *testing.T) {
|
|||
func TestReadCredentialsGroups(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
mockedResp *objectstorage.GetCredentialsGroupsResponse
|
||||
mockedResp *objectstorage.ListCredentialsGroupsResponse
|
||||
expected Model
|
||||
getCredentialsGroupsFails bool
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("cid"),
|
||||
|
|
@ -190,7 +190,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("cid"),
|
||||
|
|
@ -216,7 +216,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"empty_credentials_groups",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{},
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -225,7 +225,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"nil_credentials_groups",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: nil,
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -241,7 +241,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"non_matching_credentials_group",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("foo-other"),
|
||||
|
|
@ -256,7 +256,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"error_response",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("other_id"),
|
||||
|
|
@ -273,8 +273,8 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
client := &objectStorageClientMocked{
|
||||
returnError: tt.getCredentialsGroupsFails,
|
||||
getCredentialsGroupsResp: tt.mockedResp,
|
||||
returnError: tt.getCredentialsGroupsFails,
|
||||
listCredentialsGroupsResp: tt.mockedResp,
|
||||
}
|
||||
model := &Model{
|
||||
ProjectId: tt.expected.ProjectId,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ func testAccCheckObjectStorageDestroy(s *terraform.State) error {
|
|||
bucketsToDestroy = append(bucketsToDestroy, bucketName)
|
||||
}
|
||||
|
||||
bucketsResp, err := client.GetBuckets(ctx, testutil.ProjectId).Execute()
|
||||
bucketsResp, err := client.ListBuckets(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting bucketsResp: %w", err)
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ func testAccCheckObjectStorageDestroy(s *terraform.State) error {
|
|||
credentialsGroupsToDestroy = append(credentialsGroupsToDestroy, credentialsGroupId)
|
||||
}
|
||||
|
||||
credentialsGroupsResp, err := client.GetCredentialsGroups(ctx, testutil.ProjectId).Execute()
|
||||
credentialsGroupsResp, err := client.ListCredentialsGroups(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting bucketsResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,12 +361,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -594,17 +594,17 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*opensearch.Cre
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*opensearch.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*opensearch.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &opensearch.UpdateInstancePayload{
|
||||
return &opensearch.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &opensearch.UpdateInstancePayload{
|
||||
return &opensearch.PartialUpdateInstancePayload{
|
||||
Parameters: &opensearch.InstanceParameters{
|
||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
||||
},
|
||||
|
|
@ -614,7 +614,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*opensearch.Upd
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting OpenSearch offerings: %w", err)
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *opensearch.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting OpenSearch offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputParameters *parametersModel
|
||||
expected *opensearch.UpdateInstancePayload
|
||||
expected *opensearch.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
¶metersModel{},
|
||||
&opensearch.UpdateInstancePayload{
|
||||
&opensearch.PartialUpdateInstancePayload{
|
||||
Parameters: &opensearch.InstanceParameters{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -241,7 +241,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringValue("sgw"),
|
||||
},
|
||||
&opensearch.UpdateInstancePayload{
|
||||
&opensearch.PartialUpdateInstancePayload{
|
||||
Parameters: &opensearch.InstanceParameters{
|
||||
SgwAcl: utils.Ptr("sgw"),
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringNull(),
|
||||
},
|
||||
&opensearch.UpdateInstancePayload{
|
||||
&opensearch.PartialUpdateInstancePayload{
|
||||
Parameters: &opensearch.InstanceParameters{
|
||||
SgwAcl: nil,
|
||||
},
|
||||
|
|
@ -278,7 +278,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
PlanId: types.StringValue("plan"),
|
||||
},
|
||||
nil,
|
||||
&opensearch.UpdateInstancePayload{
|
||||
&opensearch.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ func testAccCheckOpenSearchDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,12 +412,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
_, err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
_, err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", err.Error())
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -590,14 +590,14 @@ func toCreatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}
|
||||
|
||||
return &postgresflex.CreateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &acl,
|
||||
},
|
||||
BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule),
|
||||
FlavorId: conversion.StringValueToPointer(flavor.Id),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Replicas: conversion.Int64ValueToPointer(model.Replicas),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: conversion.StringValueToPointer(storage.Class),
|
||||
Size: conversion.Int64ValueToPointer(storage.Size),
|
||||
},
|
||||
|
|
@ -605,7 +605,7 @@ func toCreatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *storageModel) (*postgresflex.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *storageModel) (*postgresflex.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
|
@ -619,15 +619,15 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
return nil, fmt.Errorf("nil storage")
|
||||
}
|
||||
|
||||
return &postgresflex.UpdateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
return &postgresflex.PartialUpdateInstancePayload{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &acl,
|
||||
},
|
||||
BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule),
|
||||
FlavorId: conversion.StringValueToPointer(flavor.Id),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Replicas: conversion.Int64ValueToPointer(model.Replicas),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: conversion.StringValueToPointer(storage.Class),
|
||||
Size: conversion.Int64ValueToPointer(storage.Size),
|
||||
},
|
||||
|
|
@ -636,7 +636,7 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
}
|
||||
|
||||
type postgresFlexClient interface {
|
||||
GetFlavorsExecute(ctx context.Context, projectId string) (*postgresflex.FlavorsResponse, error)
|
||||
ListFlavorsExecute(ctx context.Context, projectId string) (*postgresflex.ListFlavorsResponse, error)
|
||||
}
|
||||
|
||||
func loadFlavorId(ctx context.Context, client postgresFlexClient, model *Model, flavor *flavorModel) error {
|
||||
|
|
@ -656,7 +656,7 @@ func loadFlavorId(ctx context.Context, client postgresFlexClient, model *Model,
|
|||
}
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := client.GetFlavorsExecute(ctx, projectId)
|
||||
res, err := client.ListFlavorsExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("listing postgresflex flavors: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import (
|
|||
|
||||
type postgresFlexClientMocked struct {
|
||||
returnError bool
|
||||
getFlavorsResp *postgresflex.FlavorsResponse
|
||||
getFlavorsResp *postgresflex.ListFlavorsResponse
|
||||
}
|
||||
|
||||
func (c *postgresFlexClientMocked) GetFlavorsExecute(_ context.Context, _ string) (*postgresflex.FlavorsResponse, error) {
|
||||
func (c *postgresFlexClientMocked) ListFlavorsExecute(_ context.Context, _ string) (*postgresflex.ListFlavorsResponse, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("get flavors failed")
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"default_values",
|
||||
&postgresflex.InstanceResponse{
|
||||
Item: &postgresflex.InstanceSingleInstance{},
|
||||
Item: &postgresflex.Instance{},
|
||||
},
|
||||
&flavorModel{},
|
||||
&storageModel{},
|
||||
|
|
@ -66,8 +66,8 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&postgresflex.InstanceResponse{
|
||||
Item: &postgresflex.InstanceSingleInstance{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Item: &postgresflex.Instance{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip1",
|
||||
"ip2",
|
||||
|
|
@ -75,7 +75,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
},
|
||||
BackupSchedule: utils.Ptr("schedule"),
|
||||
Flavor: &postgresflex.InstanceFlavor{
|
||||
Flavor: &postgresflex.Flavor{
|
||||
Cpu: utils.Ptr(int64(12)),
|
||||
Description: utils.Ptr("description"),
|
||||
Id: utils.Ptr("flavor_id"),
|
||||
|
|
@ -85,7 +85,7 @@ func TestMapFields(t *testing.T) {
|
|||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(78)),
|
||||
},
|
||||
|
|
@ -123,8 +123,8 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"simple_values_no_flavor_and_storage",
|
||||
&postgresflex.InstanceResponse{
|
||||
Item: &postgresflex.InstanceSingleInstance{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Item: &postgresflex.Instance{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip1",
|
||||
"ip2",
|
||||
|
|
@ -232,10 +232,10 @@ func TestToCreatePayload(t *testing.T) {
|
|||
&flavorModel{},
|
||||
&storageModel{},
|
||||
&postgresflex.CreateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{},
|
||||
},
|
||||
Storage: &postgresflex.InstanceStorage{},
|
||||
Storage: &postgresflex.Storage{},
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -259,7 +259,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Size: types.Int64Value(34),
|
||||
},
|
||||
&postgresflex.CreateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip_1",
|
||||
"ip_2",
|
||||
|
|
@ -269,7 +269,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
|
|
@ -296,7 +296,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Size: types.Int64Null(),
|
||||
},
|
||||
&postgresflex.CreateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"",
|
||||
},
|
||||
|
|
@ -305,7 +305,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
},
|
||||
|
|
@ -376,7 +376,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
inputAcl []string
|
||||
inputFlavor *flavorModel
|
||||
inputStorage *storageModel
|
||||
expected *postgresflex.UpdateInstancePayload
|
||||
expected *postgresflex.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
|
|
@ -385,11 +385,11 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
[]string{},
|
||||
&flavorModel{},
|
||||
&storageModel{},
|
||||
&postgresflex.UpdateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
&postgresflex.PartialUpdateInstancePayload{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{},
|
||||
},
|
||||
Storage: &postgresflex.InstanceStorage{},
|
||||
Storage: &postgresflex.Storage{},
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -412,8 +412,8 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Class: types.StringValue("class"),
|
||||
Size: types.Int64Value(34),
|
||||
},
|
||||
&postgresflex.UpdateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
&postgresflex.PartialUpdateInstancePayload{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"ip_1",
|
||||
"ip_2",
|
||||
|
|
@ -423,7 +423,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
|
|
@ -449,8 +449,8 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Class: types.StringNull(),
|
||||
Size: types.Int64Null(),
|
||||
},
|
||||
&postgresflex.UpdateInstancePayload{
|
||||
Acl: &postgresflex.InstanceAcl{
|
||||
&postgresflex.PartialUpdateInstancePayload{
|
||||
Acl: &postgresflex.ACL{
|
||||
Items: &[]string{
|
||||
"",
|
||||
},
|
||||
|
|
@ -459,7 +459,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Storage: &postgresflex.Storage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
},
|
||||
|
|
@ -527,7 +527,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
tests := []struct {
|
||||
description string
|
||||
inputFlavor *flavorModel
|
||||
mockedResp *postgresflex.FlavorsResponse
|
||||
mockedResp *postgresflex.ListFlavorsResponse
|
||||
expected *flavorModel
|
||||
getFlavorsFails bool
|
||||
isValid bool
|
||||
|
|
@ -538,8 +538,8 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&postgresflex.FlavorsResponse{
|
||||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
&postgresflex.ListFlavorsResponse{
|
||||
Flavors: &[]postgresflex.Flavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
|
|
@ -563,8 +563,8 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&postgresflex.FlavorsResponse{
|
||||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
&postgresflex.ListFlavorsResponse{
|
||||
Flavors: &[]postgresflex.Flavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
|
|
@ -594,8 +594,8 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&postgresflex.FlavorsResponse{
|
||||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
&postgresflex.ListFlavorsResponse{
|
||||
Flavors: &[]postgresflex.Flavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
|
|
@ -623,7 +623,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&postgresflex.FlavorsResponse{},
|
||||
&postgresflex.ListFlavorsResponse{},
|
||||
&flavorModel{
|
||||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
|
|
@ -637,7 +637,7 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
},
|
||||
&postgresflex.FlavorsResponse{},
|
||||
&postgresflex.ListFlavorsResponse{},
|
||||
&flavorModel{
|
||||
CPU: types.Int64Value(2),
|
||||
RAM: types.Int64Value(8),
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ func testAccCheckPostgresFlexDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ func (r *userDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
|
|||
tflog.Info(ctx, "PostgresFlex user read")
|
||||
}
|
||||
|
||||
func mapDataSourceFields(userResp *postgresflex.UserResponse, model *DataSourceModel) error {
|
||||
func mapDataSourceFields(userResp *postgresflex.GetUserResponse, model *DataSourceModel) error {
|
||||
if userResp == nil || userResp.Item == nil {
|
||||
return fmt.Errorf("response is nil")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ import (
|
|||
func TestMapDataSourceFields(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
input *postgresflex.UserResponse
|
||||
input *postgresflex.GetUserResponse
|
||||
expected DataSourceModel
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{},
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{},
|
||||
},
|
||||
DataSourceModel{
|
||||
Id: types.StringValue("pid,iid,uid"),
|
||||
|
|
@ -36,8 +36,8 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
"role_2",
|
||||
|
|
@ -66,8 +66,8 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"null_fields_and_int_conversions",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
|
|
@ -95,14 +95,14 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"nil_response_2",
|
||||
&postgresflex.UserResponse{},
|
||||
&postgresflex.GetUserResponse{},
|
||||
DataSourceModel{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"no_resource_id",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{},
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{},
|
||||
},
|
||||
DataSourceModel{},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ func mapFieldsCreate(userResp *postgresflex.CreateUserResponse, model *Model) er
|
|||
return nil
|
||||
}
|
||||
|
||||
func mapFields(userResp *postgresflex.UserResponse, model *Model) error {
|
||||
func mapFields(userResp *postgresflex.GetUserResponse, model *Model) error {
|
||||
if userResp == nil || userResp.Item == nil {
|
||||
return fmt.Errorf("response is nil")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"default_values",
|
||||
&postgresflex.CreateUserResponse{
|
||||
Item: &postgresflex.InstanceUser{
|
||||
Item: &postgresflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Password: utils.Ptr(""),
|
||||
},
|
||||
|
|
@ -41,7 +41,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
&postgresflex.CreateUserResponse{
|
||||
Item: &postgresflex.InstanceUser{
|
||||
Item: &postgresflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
|
|
@ -74,7 +74,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"null_fields_and_int_conversions",
|
||||
&postgresflex.CreateUserResponse{
|
||||
Item: &postgresflex.InstanceUser{
|
||||
Item: &postgresflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
|
|
@ -111,7 +111,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"no_resource_id",
|
||||
&postgresflex.CreateUserResponse{
|
||||
Item: &postgresflex.InstanceUser{},
|
||||
Item: &postgresflex.User{},
|
||||
},
|
||||
Model{},
|
||||
false,
|
||||
|
|
@ -119,7 +119,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
{
|
||||
"no_password",
|
||||
&postgresflex.CreateUserResponse{
|
||||
Item: &postgresflex.InstanceUser{
|
||||
Item: &postgresflex.User{
|
||||
Id: utils.Ptr("uid"),
|
||||
},
|
||||
},
|
||||
|
|
@ -153,14 +153,14 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
func TestMapFields(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
input *postgresflex.UserResponse
|
||||
input *postgresflex.GetUserResponse
|
||||
expected Model
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{},
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{},
|
||||
},
|
||||
Model{
|
||||
Id: types.StringValue("pid,iid,uid"),
|
||||
|
|
@ -176,8 +176,8 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{
|
||||
Roles: &[]string{
|
||||
"role_1",
|
||||
"role_2",
|
||||
|
|
@ -206,8 +206,8 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"null_fields_and_int_conversions",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{
|
||||
Id: utils.Ptr("uid"),
|
||||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
|
|
@ -235,14 +235,14 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"nil_response_2",
|
||||
&postgresflex.UserResponse{},
|
||||
&postgresflex.GetUserResponse{},
|
||||
Model{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"no_resource_id",
|
||||
&postgresflex.UserResponse{
|
||||
Item: &postgresflex.UserResponseUser{},
|
||||
&postgresflex.GetUserResponse{
|
||||
Item: &postgresflex.UserResponse{},
|
||||
},
|
||||
Model{},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -437,12 +437,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -463,17 +463,17 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
tflog.Info(ctx, "PostgreSQL instance updated")
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel, parametersPlugins *[]string) (*postgresql.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel, parametersPlugins *[]string) (*postgresql.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &postgresql.UpdateInstancePayload{
|
||||
return &postgresql.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &postgresql.UpdateInstancePayload{
|
||||
return &postgresql.PartialUpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: conversion.BoolValueToPointer(parameters.EnableMonitoring),
|
||||
MetricsFrequency: conversion.Int64ValueToPointer(parameters.MetricsFrequency),
|
||||
|
|
@ -674,7 +674,7 @@ func mapParameters(params map[string]interface{}) (types.Object, error) {
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting PostgreSQL offerings: %w", err)
|
||||
}
|
||||
|
|
@ -712,7 +712,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *postgresql.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting PostgreSQL offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
input *Model
|
||||
inputParameters *parametersModel
|
||||
inputParametersPlugins *[]string
|
||||
expected *postgresql.UpdateInstancePayload
|
||||
expected *postgresql.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
&Model{},
|
||||
¶metersModel{},
|
||||
&[]string{},
|
||||
&postgresql.UpdateInstancePayload{
|
||||
&postgresql.PartialUpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
Plugins: &[]string{},
|
||||
},
|
||||
|
|
@ -348,7 +348,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
"plugin_1",
|
||||
"plugin_2",
|
||||
},
|
||||
&postgresql.UpdateInstancePayload{
|
||||
&postgresql.PartialUpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: utils.Ptr(true),
|
||||
MetricsFrequency: utils.Ptr(int64(123)),
|
||||
|
|
@ -379,7 +379,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
&[]string{
|
||||
"",
|
||||
},
|
||||
&postgresql.UpdateInstancePayload{
|
||||
&postgresql.PartialUpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: nil,
|
||||
MetricsFrequency: utils.Ptr(int64(2123456789)),
|
||||
|
|
@ -409,7 +409,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
},
|
||||
nil,
|
||||
nil,
|
||||
&postgresql.UpdateInstancePayload{
|
||||
&postgresql.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ func testAccCheckPostgreSQLDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,12 +361,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -594,17 +594,17 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*rabbitmq.Creat
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*rabbitmq.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*rabbitmq.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &rabbitmq.UpdateInstancePayload{
|
||||
return &rabbitmq.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &rabbitmq.UpdateInstancePayload{
|
||||
return &rabbitmq.PartialUpdateInstancePayload{
|
||||
Parameters: &rabbitmq.InstanceParameters{
|
||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
||||
},
|
||||
|
|
@ -614,7 +614,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*rabbitmq.Updat
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting RabbitMQ offerings: %w", err)
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *rabbitmq.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting RabbitMQ offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputParameters *parametersModel
|
||||
expected *rabbitmq.UpdateInstancePayload
|
||||
expected *rabbitmq.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
¶metersModel{},
|
||||
&rabbitmq.UpdateInstancePayload{
|
||||
&rabbitmq.PartialUpdateInstancePayload{
|
||||
Parameters: &rabbitmq.InstanceParameters{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -241,7 +241,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringValue("sgw"),
|
||||
},
|
||||
&rabbitmq.UpdateInstancePayload{
|
||||
&rabbitmq.PartialUpdateInstancePayload{
|
||||
Parameters: &rabbitmq.InstanceParameters{
|
||||
SgwAcl: utils.Ptr("sgw"),
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringNull(),
|
||||
},
|
||||
&rabbitmq.UpdateInstancePayload{
|
||||
&rabbitmq.PartialUpdateInstancePayload{
|
||||
Parameters: &rabbitmq.InstanceParameters{
|
||||
SgwAcl: nil,
|
||||
},
|
||||
|
|
@ -278,7 +278,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
PlanId: types.StringValue("plan"),
|
||||
},
|
||||
nil,
|
||||
&rabbitmq.UpdateInstancePayload{
|
||||
&rabbitmq.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ func testAccCheckRabbitMQDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,12 +361,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
// Update existing instance
|
||||
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
|
||||
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
|
|
@ -594,17 +594,17 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*redis.CreateIn
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*redis.UpdateInstancePayload, error) {
|
||||
func toUpdatePayload(model *Model, parameters *parametersModel) (*redis.PartialUpdateInstancePayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
||||
if parameters == nil {
|
||||
return &redis.UpdateInstancePayload{
|
||||
return &redis.PartialUpdateInstancePayload{
|
||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||
}, nil
|
||||
}
|
||||
return &redis.UpdateInstancePayload{
|
||||
return &redis.PartialUpdateInstancePayload{
|
||||
Parameters: &redis.InstanceParameters{
|
||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
||||
},
|
||||
|
|
@ -614,7 +614,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*redis.UpdateIn
|
|||
|
||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
res, err := r.client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting Redis offerings: %w", err)
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
|||
func loadPlanNameAndVersion(ctx context.Context, client *redis.APIClient, model *Model) error {
|
||||
projectId := model.ProjectId.ValueString()
|
||||
planId := model.PlanId.ValueString()
|
||||
res, err := client.GetOfferings(ctx, projectId).Execute()
|
||||
res, err := client.ListOfferings(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting Redis offerings: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputParameters *parametersModel
|
||||
expected *redis.UpdateInstancePayload
|
||||
expected *redis.PartialUpdateInstancePayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&Model{},
|
||||
¶metersModel{},
|
||||
&redis.UpdateInstancePayload{
|
||||
&redis.PartialUpdateInstancePayload{
|
||||
Parameters: &redis.InstanceParameters{},
|
||||
},
|
||||
true,
|
||||
|
|
@ -241,7 +241,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringValue("sgw"),
|
||||
},
|
||||
&redis.UpdateInstancePayload{
|
||||
&redis.PartialUpdateInstancePayload{
|
||||
Parameters: &redis.InstanceParameters{
|
||||
SgwAcl: utils.Ptr("sgw"),
|
||||
},
|
||||
|
|
@ -257,7 +257,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
¶metersModel{
|
||||
SgwAcl: types.StringNull(),
|
||||
},
|
||||
&redis.UpdateInstancePayload{
|
||||
&redis.PartialUpdateInstancePayload{
|
||||
Parameters: &redis.InstanceParameters{
|
||||
SgwAcl: nil,
|
||||
},
|
||||
|
|
@ -278,7 +278,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
PlanId: types.StringValue("plan"),
|
||||
},
|
||||
nil,
|
||||
&redis.UpdateInstancePayload{
|
||||
&redis.PartialUpdateInstancePayload{
|
||||
PlanId: utils.Ptr("plan"),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ func testAccCheckRedisDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest
|
|||
return
|
||||
}
|
||||
// Update existing project
|
||||
_, err = r.client.UpdateProject(ctx, containerId).UpdateProjectPayload(*payload).Execute()
|
||||
_, err = r.client.PartialUpdateProject(ctx, containerId).PartialUpdateProjectPayload(*payload).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating project", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -454,7 +454,7 @@ func toCreatePayload(model *Model, serviceAccountEmail string) (*resourcemanager
|
|||
}, nil
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model) (*resourcemanager.UpdateProjectPayload, error) {
|
||||
func toUpdatePayload(model *Model) (*resourcemanager.PartialUpdateProjectPayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ func toUpdatePayload(model *Model) (*resourcemanager.UpdateProjectPayload, error
|
|||
return nil, fmt.Errorf("converting to GO map: %w", err)
|
||||
}
|
||||
|
||||
return &resourcemanager.UpdateProjectPayload{
|
||||
return &resourcemanager.PartialUpdateProjectPayload{
|
||||
ContainerParentId: conversion.StringValueToPointer(model.ContainerParentId),
|
||||
Name: conversion.StringValueToPointer(model.Name),
|
||||
Labels: labels,
|
||||
|
|
|
|||
|
|
@ -250,14 +250,14 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
description string
|
||||
input *Model
|
||||
inputLabels *map[string]string
|
||||
expected *resourcemanager.UpdateProjectPayload
|
||||
expected *resourcemanager.PartialUpdateProjectPayload
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_ok",
|
||||
&Model{},
|
||||
nil,
|
||||
&resourcemanager.UpdateProjectPayload{
|
||||
&resourcemanager.PartialUpdateProjectPayload{
|
||||
ContainerParentId: nil,
|
||||
Labels: nil,
|
||||
Name: nil,
|
||||
|
|
@ -275,7 +275,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
"label1": "1",
|
||||
"label2": "2",
|
||||
},
|
||||
&resourcemanager.UpdateProjectPayload{
|
||||
&resourcemanager.PartialUpdateProjectPayload{
|
||||
ContainerParentId: utils.Ptr("pid"),
|
||||
Labels: &map[string]string{
|
||||
"label1": "1",
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ func testAccCheckResourceManagerDestroy(s *terraform.State) error {
|
|||
projectsToDestroy = append(projectsToDestroy, containerId)
|
||||
}
|
||||
|
||||
projectsResp, err := client.GetProjects(ctx).ContainerParentId(projectResource["parent_container_id"]).Execute()
|
||||
projectsResp, err := client.ListProjects(ctx).ContainerParentId(projectResource["parent_container_id"]).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting projectsResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func (r *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
aclList, err := r.client.GetAcls(ctx, projectId, instanceId).Execute()
|
||||
aclList, err := r.client.ListACLs(ctx, projectId, instanceId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API for ACLs data: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Creating ACLs: %v", err))
|
||||
return
|
||||
}
|
||||
aclList, err := r.client.GetAcls(ctx, projectId, instanceId).Execute()
|
||||
aclList, err := r.client.ListACLs(ctx, projectId, instanceId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Calling API for ACLs data: %v", err))
|
||||
return
|
||||
|
|
@ -239,7 +239,7 @@ func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, r
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
aclList, err := r.client.GetAcls(ctx, projectId, instanceId).Execute()
|
||||
aclList, err := r.client.ListACLs(ctx, projectId, instanceId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API for ACLs data: %v", err))
|
||||
return
|
||||
|
|
@ -295,7 +295,7 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
aclList, err := r.client.GetAcls(ctx, projectId, instanceId).Execute()
|
||||
aclList, err := r.client.ListACLs(ctx, projectId, instanceId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API for ACLs data: %v", err))
|
||||
return
|
||||
|
|
@ -425,7 +425,7 @@ func toCreatePayload(model *Model) (*secretsmanager.CreateInstancePayload, error
|
|||
// updateACLs creates and deletes ACLs so that the instance's ACLs are the ones in the model
|
||||
func updateACLs(ctx context.Context, projectId, instanceId string, acls []string, client *secretsmanager.APIClient) error {
|
||||
// Get ACLs current state
|
||||
currentACLsResp, err := client.GetAcls(ctx, projectId, instanceId).Execute()
|
||||
currentACLsResp, err := client.ListACLs(ctx, projectId, instanceId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetching current ACLs: %w", err)
|
||||
}
|
||||
|
|
@ -453,17 +453,17 @@ func updateACLs(ctx context.Context, projectId, instanceId string, acls []string
|
|||
// Create/delete ACLs
|
||||
for cidr, state := range aclsState {
|
||||
if state.isInModel && !state.isCreated {
|
||||
payload := secretsmanager.CreateAclPayload{
|
||||
payload := secretsmanager.CreateACLPayload{
|
||||
Cidr: utils.Ptr(cidr),
|
||||
}
|
||||
_, err := client.CreateAcl(ctx, projectId, instanceId).CreateAclPayload(payload).Execute()
|
||||
_, err := client.CreateACL(ctx, projectId, instanceId).CreateACLPayload(payload).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating ACL '%v': %w", cidr, err)
|
||||
}
|
||||
}
|
||||
|
||||
if !state.isInModel && state.isCreated {
|
||||
err := client.DeleteAcl(ctx, projectId, instanceId, state.id).Execute()
|
||||
err := client.DeleteACL(ctx, projectId, instanceId, state.id).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting ACL '%v': %w", cidr, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ func TestUpdateACLs(t *testing.T) {
|
|||
// Handler for creating ACL
|
||||
createACLHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
var payload secretsmanager.CreateAclPayload
|
||||
var payload secretsmanager.CreateACLPayload
|
||||
err := decoder.Decode(&payload)
|
||||
if err != nil {
|
||||
t.Errorf("Create ACL handler: failed to parse payload")
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ func testAccCheckSecretsManagerDestroy(s *terraform.State) error {
|
|||
instancesToDestroy = append(instancesToDestroy, instanceId)
|
||||
}
|
||||
|
||||
instancesResp, err := client.GetInstances(ctx, testutil.ProjectId).Execute()
|
||||
instancesResp, err := client.ListInstances(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting instancesResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ func (r *clusterResource) Create(ctx context.Context, req resource.CreateRequest
|
|||
|
||||
func (r *clusterResource) loadAvaiableVersions(ctx context.Context) ([]ske.KubernetesVersion, error) {
|
||||
c := r.client
|
||||
res, err := c.GetOptions(ctx).Execute()
|
||||
res, err := c.ListProviderOptions(ctx).Execute()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("calling API: %w", err)
|
||||
}
|
||||
|
|
@ -878,7 +878,7 @@ func toMaintenancePayload(ctx context.Context, m *Cluster) (*ske.Maintenance, er
|
|||
}, nil
|
||||
}
|
||||
|
||||
func mapFields(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
||||
func mapFields(ctx context.Context, cl *ske.Cluster, m *Cluster) error {
|
||||
if cl == nil {
|
||||
return fmt.Errorf("response input is nil")
|
||||
}
|
||||
|
|
@ -933,7 +933,7 @@ func mapFields(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func mapNodePools(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
||||
func mapNodePools(ctx context.Context, cl *ske.Cluster, m *Cluster) error {
|
||||
if cl.Nodepools == nil {
|
||||
m.NodePools = types.ListNull(types.ObjectType{AttrTypes: nodePoolTypes})
|
||||
return nil
|
||||
|
|
@ -1039,7 +1039,7 @@ func mapTaints(t *[]ske.Taint, nodePool map[string]attr.Value) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func mapHibernations(cl *ske.ClusterResponse, m *Cluster) error {
|
||||
func mapHibernations(cl *ske.Cluster, m *Cluster) error {
|
||||
if cl.Hibernation == nil {
|
||||
if !m.Hibernations.IsNull() {
|
||||
emptyHibernations, diags := basetypes.NewListValue(basetypes.ObjectType{AttrTypes: hibernationTypes}, []attr.Value{})
|
||||
|
|
@ -1085,7 +1085,7 @@ func mapHibernations(cl *ske.ClusterResponse, m *Cluster) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func mapMaintenance(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
||||
func mapMaintenance(ctx context.Context, cl *ske.Cluster, m *Cluster) error {
|
||||
// Aligned with SKE team that a flattened data structure is fine, because no extensions are planned.
|
||||
if cl.Maintenance == nil {
|
||||
m.Maintenance = types.ObjectNull(maintenanceTypes)
|
||||
|
|
@ -1117,7 +1117,7 @@ func mapMaintenance(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) er
|
|||
return nil
|
||||
}
|
||||
|
||||
func getMaintenanceTimes(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) (startTime, endTime string, err error) {
|
||||
func getMaintenanceTimes(ctx context.Context, cl *ske.Cluster, m *Cluster) (startTime, endTime string, err error) {
|
||||
startTimeAPI, err := time.Parse(time.RFC3339, *cl.Maintenance.TimeWindow.Start)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("parsing start time '%s' from API response as RFC3339 datetime: %w", *cl.Maintenance.TimeWindow.Start, err)
|
||||
|
|
@ -1191,7 +1191,7 @@ func checkDisabledExtensions(ctx context.Context, ex extensions) (aclDisabled, a
|
|||
return !acl.Enabled.ValueBool(), !argus.Enabled.ValueBool(), nil
|
||||
}
|
||||
|
||||
func mapExtensions(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
||||
func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Cluster) error {
|
||||
if cl.Extensions == nil {
|
||||
m.Extensions = types.ObjectNull(extensionsTypes)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ func TestMapFields(t *testing.T) {
|
|||
tests := []struct {
|
||||
description string
|
||||
stateExtensions types.Object
|
||||
input *ske.ClusterResponse
|
||||
input *ske.Cluster
|
||||
expected Cluster
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
types.ObjectNull(extensionsTypes),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Name: utils.Ptr("name"),
|
||||
},
|
||||
Cluster{
|
||||
|
|
@ -44,7 +44,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"simple_values",
|
||||
types.ObjectNull(extensionsTypes),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Extensions: &ske.Extension{
|
||||
Acl: &ske.ACL{
|
||||
AllowedCidrs: &[]string{"cidr1"},
|
||||
|
|
@ -210,7 +210,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"extensions_mixed_values",
|
||||
types.ObjectNull(extensionsTypes),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Extensions: &ske.Extension{
|
||||
Acl: &ske.ACL{
|
||||
AllowedCidrs: nil,
|
||||
|
|
@ -258,7 +258,7 @@ func TestMapFields(t *testing.T) {
|
|||
"argus_instance_id": types.StringNull(),
|
||||
}),
|
||||
}),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Extensions: &ske.Extension{},
|
||||
Name: utils.Ptr("name"),
|
||||
},
|
||||
|
|
@ -299,7 +299,7 @@ func TestMapFields(t *testing.T) {
|
|||
"argus_instance_id": types.StringValue("id"),
|
||||
}),
|
||||
}),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Extensions: &ske.Extension{
|
||||
Acl: &ske.ACL{
|
||||
AllowedCidrs: &[]string{"cidr1"},
|
||||
|
|
@ -336,7 +336,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"extensions_not_set",
|
||||
types.ObjectNull(extensionsTypes),
|
||||
&ske.ClusterResponse{
|
||||
&ske.Cluster{
|
||||
Extensions: &ske.Extension{},
|
||||
Name: utils.Ptr("name"),
|
||||
},
|
||||
|
|
@ -364,7 +364,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
"no_resource_id",
|
||||
types.ObjectNull(extensionsTypes),
|
||||
&ske.ClusterResponse{},
|
||||
&ske.Cluster{},
|
||||
Cluster{},
|
||||
false,
|
||||
},
|
||||
|
|
@ -686,7 +686,7 @@ func TestGetMaintenanceTimes(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
apiResponse := &ske.ClusterResponse{
|
||||
apiResponse := &ske.Cluster{
|
||||
Maintenance: &ske.Maintenance{
|
||||
TimeWindow: &ske.TimeWindow{
|
||||
Start: utils.Ptr(tt.startAPI),
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ func (r *projectDataSource) Read(ctx context.Context, req datasource.ReadRequest
|
|||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
_, err := r.client.GetProject(ctx, projectId).Execute()
|
||||
_, err := r.client.GetServiceStatus(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading project", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -118,14 +118,14 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest
|
|||
return
|
||||
}
|
||||
projectId := model.ProjectId.ValueString()
|
||||
_, err := r.client.CreateProject(ctx, projectId).Execute()
|
||||
_, err := r.client.EnableService(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating project", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
model.Id = types.StringValue(projectId)
|
||||
_, err = wait.CreateProjectWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
_, err = wait.EnableServiceWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating cluster", fmt.Sprintf("Project creation waiting: %v", err))
|
||||
return
|
||||
|
|
@ -148,7 +148,7 @@ func (r *projectResource) Read(ctx context.Context, req resource.ReadRequest, re
|
|||
return
|
||||
}
|
||||
projectId := model.ProjectId.ValueString()
|
||||
_, err := r.client.GetProject(ctx, projectId).Execute()
|
||||
_, err := r.client.GetServiceStatus(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading project", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
|
|
@ -180,12 +180,12 @@ func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest
|
|||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
|
||||
c := r.client
|
||||
_, err := c.DeleteProject(ctx, projectId).Execute()
|
||||
_, err := c.DisableService(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
_, err = wait.DisableServiceWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Project deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ func testAccCheckSKEDestroy(s *terraform.State) error {
|
|||
projectsToDestroy = append(projectsToDestroy, rs.Primary.ID)
|
||||
}
|
||||
for _, projectId := range projectsToDestroy {
|
||||
_, err := client.GetProject(ctx, projectId).Execute()
|
||||
_, err := client.GetServiceStatus(ctx, projectId).Execute()
|
||||
if err != nil {
|
||||
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
||||
if !ok {
|
||||
|
|
@ -540,11 +540,11 @@ func testAccCheckSKEDestroy(s *terraform.State) error {
|
|||
return fmt.Errorf("getting project: %w", err)
|
||||
}
|
||||
|
||||
_, err = client.DeleteProjectExecute(ctx, projectId)
|
||||
_, err = client.DisableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("destroying project %s during CheckDestroy: %w", projectId, err)
|
||||
}
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, client, projectId).WaitWithContext(ctx)
|
||||
_, err = wait.DisableServiceWaitHandler(ctx, client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("destroying project %s during CheckDestroy: waiting for deletion %w", projectId, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue