diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23c64595f..f40869f83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,6 +74,8 @@ jobs: # GitHub sets the GITHUB_TOKEN secret automatically. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + METRICS_TARGET: ${{ secrets.METRICS_TARGET }} + METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }} highest-version-tag: needs: [goreleaser] runs-on: ubuntu-latest diff --git a/.goreleaser.yml b/.goreleaser.yml index 29229af71..547ec1cbb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,7 +14,7 @@ builds: flags: - -trimpath ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics.version={{.Version}} -X github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics.target={{ .Env.METRICS_TARGET }} -X github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics.token={{ .Env.METRICS_TOKEN }}"' goos: - freebsd - windows diff --git a/go.mod b/go.mod index b01e76d57..61228e409 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ module github.com/orange-cloudavenue/terraform-provider-cloudavenue -go 1.20 +go 1.21.0 require ( + github.com/FrangipaneTeam/terraform-analytic-tool v0.0.11 github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.3 github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.5.3 github.com/FrangipaneTeam/terraform-plugin-framework-supertypes v0.1.0 @@ -15,13 +16,14 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 github.com/hashicorp/terraform-plugin-go v0.18.0 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/iancoleman/strcase v0.3.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 + github.com/iancoleman/strcase v0.3.0 github.com/orange-cloudavenue/cloudavenue-sdk-go v0.1.2 github.com/rs/zerolog v1.30.0 github.com/vmware/go-vcloud-director/v2 v2.21.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df golang.org/x/net v0.15.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -30,12 +32,19 @@ require ( github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect github.com/agext/levenshtein v1.2.3 // indirect + github.com/ajg/form v1.5.1 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect + github.com/deepmap/oapi-codegen v1.8.2 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fatih/color v1.15.0 // indirect + github.com/go-chi/chi v4.0.2+incompatible // indirect + github.com/go-chi/render v1.0.3 // indirect + github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -57,6 +66,8 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.15 // indirect + github.com/influxdata/influxdb-client-go/v2 v2.12.3 // indirect + github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -69,6 +80,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.1.0 // indirect github.com/peterhellberg/link v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/posener/complete v1.2.3 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/russross/blackfriday v1.6.0 // indirect diff --git a/go.sum b/go.sum index d4826c95a..9bb630a2c 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/FrangipaneTeam/terraform-analytic-tool v0.0.11 h1:tVGbb/aESADP7oz0KiQ/+1VaQUOGUjrzVRVy7FCs4UY= +github.com/FrangipaneTeam/terraform-analytic-tool v0.0.11/go.mod h1:GLtsNXwlVsMPZwX2RSSpyWsq7drpc08nfNdNP5AllRM= github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.3 h1:EN8dEPUe7ug/3YvvtSOm0V16yITZKC/aOiXXCgNRpHo= github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.3/go.mod h1:UVMaqiY8KZkemfQZ4NclIsIFclq9y52kvhE19sSBcmI= github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.5.3 h1:IK/b9zbnYIu3EgSCooYxLG/7QH/B0tAAYlgKyM73VvU= @@ -15,11 +17,15 @@ github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFP github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= +github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -33,31 +39,60 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g= +github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY= +github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= +github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs= +github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= +github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= +github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4= +github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= +github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= +github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= +github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= 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/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -66,6 +101,7 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -128,9 +164,16 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/influxdata/influxdb-client-go/v2 v2.12.3 h1:28nRlNMRIV4QbtIUvxhWqaxn0IpXeMSkY/uJa/O/vC4= +github.com/influxdata/influxdb-client-go/v2 v2.12.3/go.mod h1:IrrLUbCjjfkmRuaCiGQg4m2GbkaeJDcuWoxiWdQEbA0= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= +github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -139,12 +182,23 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -165,14 +219,23 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/orange-cloudavenue/cloudavenue-sdk-go v0.1.2 h1:xyuYnnne38RHQqnFw1d5M9FllvlWN4qNQDKV1AQNGpI= github.com/orange-cloudavenue/cloudavenue-sdk-go v0.1.2/go.mod h1:bMSQ+EQ0CtwIca1J133sM9fc/4cAfLXN3r4TpnS0BDY= github.com/peterhellberg/link v1.2.0 h1:UA5pg3Gp/E0F2WdX7GERiNrPQrM1K6CVJUUWfHa4t6c= github.com/peterhellberg/link v1.2.0/go.mod h1:gYfAh+oJgQu2SrZHg5hROVRQe1ICoK0/HHJTcE0edxc= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -189,21 +252,28 @@ github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3V github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= +github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= 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= @@ -214,12 +284,15 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV github.com/vmware/go-vcloud-director/v2 v2.21.0 h1:zIONrJpM+Fj+rDyXmsRfMAn1sP5WAP87USL0T9GS4DY= github.com/vmware/go-vcloud-director/v2 v2.21.0/go.mod h1:QPxGFgrUcSyzy9IlpwDE4UNT3tsOy2047tJOPEJ4nlw= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0= github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= @@ -232,6 +305,8 @@ golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= @@ -243,10 +318,16 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ 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= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -259,18 +340,23 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -288,10 +374,14 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 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.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/metrics/action.go b/internal/metrics/action.go new file mode 100644 index 000000000..3c861ff6d --- /dev/null +++ b/internal/metrics/action.go @@ -0,0 +1,16 @@ +package metrics + +type Action string + +const ( + Create Action = "Create" + Read Action = "Read" + Update Action = "Update" + Delete Action = "Delete" + Import Action = "Import" +) + +// String returns the string representation of the action. +func (a Action) String() string { + return string(a) +} diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go new file mode 100644 index 000000000..12cbf0aa2 --- /dev/null +++ b/internal/metrics/metrics.go @@ -0,0 +1,49 @@ +package metrics + +import ( + "time" + + tat "github.com/FrangipaneTeam/terraform-analytic-tool/api" +) + +// version that can be overwritten by a release process. +var version = "dev" + +// token can be overwritten by a release process. +var token = "dev" + +// target can be overwritten by a release process. +var target = "https://localhost" + +// GlobalExecutionID is the execution ID of the current Terraform run. +var GlobalExecutionID = "" + +func New(resourceName, organizationID string, action Action) func() { + if everyThingIsOK() { + start := time.Now() + return func() { + timeElapsed := time.Since(start) + send( + tat.AnalyticRequest{ + TerraformRequest: &tat.TerraformRequest{ + TerraformExecutionID: GlobalExecutionID, + ClientVersion: "terraform-cloudavenue/" + version, + ClientToken: token, + }, + ResourceName: resourceName, + OrganizationID: organizationID, + Action: action.String(), + ExecutionTime: timeElapsed.Milliseconds(), + }) + } + } + return func() {} +} + +// everyThingIsOK Check if all variables are set. +func everyThingIsOK() bool { + if version == "" || token == "" || target == "" { + return false + } + return true +} diff --git a/internal/metrics/send.go b/internal/metrics/send.go new file mode 100644 index 000000000..908870e26 --- /dev/null +++ b/internal/metrics/send.go @@ -0,0 +1,46 @@ +package metrics + +import ( + "bytes" + "context" + "encoding/json" + "net/http" + "time" + + tat "github.com/FrangipaneTeam/terraform-analytic-tool/api" +) + +// Send is a function to send an event +// with a given configuration and client. +// This not return an error because it's not critical. +func send(event tat.AnalyticRequest) { + // Serialize and pack event + eventPkg, err := json.Marshal(event) + if err != nil { + return + } + + // Context with 1 second timeout + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) + defer cancel() + + // Compose request + req, err := http.NewRequestWithContext(ctx, "POST", target+"/api/v1/send", bytes.NewReader(eventPkg)) + if err != nil { + return + } + // Set headers + req.Header.Set("Content-Type", "application/json") + // Add Header Authorization if token is set + if token != "" { + req.Header.Set("Authorization", token) + } + + // Send request + res, err := http.DefaultClient.Do(req) + // Check error + if err != nil { + return + } + res.Body.Close() +} diff --git a/internal/provider/alb/pool_datasource.go b/internal/provider/alb/pool_datasource.go index 7129210a8..255a7b2a4 100644 --- a/internal/provider/alb/pool_datasource.go +++ b/internal/provider/alb/pool_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -78,6 +79,8 @@ func (d *albPoolDataSource) Configure(ctx context.Context, req datasource.Config } func (d *albPoolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_alb_pool", d.client.GetOrgName(), metrics.Read)() + var ( data *albPoolModel diags diag.Diagnostics diff --git a/internal/provider/alb/pool_resource.go b/internal/provider/alb/pool_resource.go index ec9c5e6e1..f56909bdf 100644 --- a/internal/provider/alb/pool_resource.go +++ b/internal/provider/alb/pool_resource.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" @@ -91,6 +92,8 @@ func (r *albPoolResource) Configure(ctx context.Context, req resource.ConfigureR // Create creates the resource and sets the initial Terraform state. func (r *albPoolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_alb_pool", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *albPoolModel @@ -139,6 +142,8 @@ func (r *albPoolResource) Create(ctx context.Context, req resource.CreateRequest // Read refreshes the Terraform state with the latest data. func (r *albPoolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_alb_pool", r.client.GetOrgName(), metrics.Read)() + var ( state *albPoolModel diags diag.Diagnostics @@ -221,6 +226,8 @@ func (r *albPoolResource) Read(ctx context.Context, req resource.ReadRequest, re // Update updates the resource and sets the updated Terraform state on success. func (r *albPoolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_alb_pool", r.client.GetOrgName(), metrics.Update)() + var plan *albPoolModel // Get current state @@ -271,6 +278,8 @@ func (r *albPoolResource) Update(ctx context.Context, req resource.UpdateRequest // Delete deletes the resource and removes the Terraform state on success. func (r *albPoolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_alb_pool", r.client.GetOrgName(), metrics.Delete)() + var state *albPoolModel // Get current state @@ -309,6 +318,8 @@ func (r *albPoolResource) Delete(ctx context.Context, req resource.DeleteRequest } func (r *albPoolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_alb_pool", r.client.GetOrgName(), metrics.Import)() + idParts := strings.Split(req.ID, ".") if len(idParts) != 2 { diff --git a/internal/provider/catalog/acl_datasource.go b/internal/provider/catalog/acl_datasource.go index 7de59ce4d..24f4a3be6 100644 --- a/internal/provider/catalog/acl_datasource.go +++ b/internal/provider/catalog/acl_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -65,6 +66,8 @@ func (d *aclDataSource) Configure(ctx context.Context, req datasource.ConfigureR } func (d *aclDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalog_acl", d.client.GetOrgName(), metrics.Read)() + config := &ACLModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/catalog/acl_resource.go b/internal/provider/catalog/acl_resource.go index b185cfd1a..80a86e5e7 100644 --- a/internal/provider/catalog/acl_resource.go +++ b/internal/provider/catalog/acl_resource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -76,6 +77,8 @@ func (r *aclResource) Configure(ctx context.Context, req resource.ConfigureReque // Create creates the resource and sets the initial Terraform state. func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_catalog_acl", r.client.GetOrgName(), metrics.Create)() + plan := &ACLModel{} // Retrieve values from plan @@ -111,6 +114,8 @@ func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, re // Read refreshes the Terraform state with the latest data. func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_catalog_acl", r.client.GetOrgName(), metrics.Read)() + state := &ACLModel{} // Get current state @@ -145,6 +150,8 @@ func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp * // Update updates the resource and sets the updated Terraform state on success. func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_catalog_acl", r.client.GetOrgName(), metrics.Update)() + var ( plan = &ACLModel{} state = &ACLModel{} @@ -184,6 +191,8 @@ func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, re // Delete deletes the resource and removes the Terraform state on success. func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_catalog_acl", r.client.GetOrgName(), metrics.Delete)() + state := &ACLModel{} // Get current state @@ -214,8 +223,9 @@ func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, re } func (r *aclResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - // import format is catalogIDOrName + defer metrics.New("cloudavenue_catalog_acl", r.client.GetOrgName(), metrics.Import)() + // import format is catalogIDOrName var d diag.Diagnostics r.adminOrg, d = adminorg.Init(r.client) diff --git a/internal/provider/catalog/catalog_datasource.go b/internal/provider/catalog/catalog_datasource.go index 882d4ee9f..8bf0e8d85 100644 --- a/internal/provider/catalog/catalog_datasource.go +++ b/internal/provider/catalog/catalog_datasource.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -77,6 +78,8 @@ func (d *catalogDataSource) Configure(ctx context.Context, req datasource.Config } func (d *catalogDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalog", d.client.GetOrgName(), metrics.Read)() + state := &catalogDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/catalog/catalog_resource.go b/internal/provider/catalog/catalog_resource.go index 598dafd2a..b6299c613 100644 --- a/internal/provider/catalog/catalog_resource.go +++ b/internal/provider/catalog/catalog_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -81,6 +82,8 @@ func (r *catalogResource) Configure(ctx context.Context, req resource.ConfigureR // Create creates the resource and sets the initial Terraform state. func (r *catalogResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_catalog", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan = &catalogResourceModel{} @@ -128,6 +131,8 @@ func (r *catalogResource) Create(ctx context.Context, req resource.CreateRequest // Read refreshes the Terraform state with the latest data. func (r *catalogResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_catalog", r.client.GetOrgName(), metrics.Read)() + state := &catalogResourceModel{} // Get current state @@ -168,6 +173,8 @@ func (r *catalogResource) Read(ctx context.Context, req resource.ReadRequest, re // Update updates the resource and sets the updated Terraform state on success. func (r *catalogResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_catalog", r.client.GetOrgName(), metrics.Update)() + var plan, state *catalogResourceModel // Get current state @@ -234,6 +241,8 @@ func (r *catalogResource) Update(ctx context.Context, req resource.UpdateRequest // Delete deletes the resource and removes the Terraform state on success. func (r *catalogResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_catalog", r.client.GetOrgName(), metrics.Delete)() + state := &catalogResourceModel{} // Get current state @@ -266,6 +275,7 @@ func (r *catalogResource) Delete(ctx context.Context, req resource.DeleteRequest } func (r *catalogResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_catalog", r.client.GetOrgName(), metrics.Import)() resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/catalog/catalog_vapp_template_datasource.go b/internal/provider/catalog/catalog_vapp_template_datasource.go index 8f9d8404b..7f8dfb61b 100644 --- a/internal/provider/catalog/catalog_vapp_template_datasource.go +++ b/internal/provider/catalog/catalog_vapp_template_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -69,6 +70,8 @@ func (d *vAppTemplateDataSource) Schema(ctx context.Context, _ datasource.Schema } func (d *vAppTemplateDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalog_vapp_template", d.client.GetOrgName(), metrics.Read)() + state := &VAPPTemplateModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/catalog/catalogs_datasource.go b/internal/provider/catalog/catalogs_datasource.go index 2b128019c..d1e710360 100644 --- a/internal/provider/catalog/catalogs_datasource.go +++ b/internal/provider/catalog/catalogs_datasource.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -69,6 +70,8 @@ func (d *catalogsDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *catalogsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalogs", d.client.GetOrgName(), metrics.Read)() + state := &catalogsDataSourceModel{} resp.Diagnostics.Append(d.Init(ctx, state)...) if resp.Diagnostics.HasError() { diff --git a/internal/provider/catalog/media_datasource.go b/internal/provider/catalog/media_datasource.go index 5b8659eec..9941e03ba 100644 --- a/internal/provider/catalog/media_datasource.go +++ b/internal/provider/catalog/media_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -49,54 +50,6 @@ func (d *catalogMediaDataSource) Metadata(ctx context.Context, req datasource.Me func (d *catalogMediaDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = mediaSchema().GetDataSource(ctx) - // schema.Schema{ - // Description: "The `catalog_media` datasource provides a Cloud Avenue Catalog media data source.", - - // Attributes: map[string]schema.Attribute{ - // "id": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The ID of the catalog media.", - // }, - // schemaName: schemaCatalogName(common.IsOptional()), - // schemaID: schemaCatalogID(common.IsOptional()), - // "name": schema.StringAttribute{ - // Required: true, - // MarkdownDescription: "The name of the media.", - // }, - // "description": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The description of the media.", - // }, - // "is_iso": schema.BoolAttribute{ - // Computed: true, - // MarkdownDescription: "True if this media file is an Iso.", - // }, - // "owner_name": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The name of the owner.", - // }, - // "is_published": schema.BoolAttribute{ - // Computed: true, - // MarkdownDescription: "True if this media file is in a published catalog.", - // }, - // "created_at": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The creation date of the media.", - // }, - // "size": schema.Int64Attribute{ - // Computed: true, - // MarkdownDescription: "The size of the media in bytes.", - // }, - // "status": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The media status.", - // }, - // "storage_profile": schema.StringAttribute{ - // Computed: true, - // MarkdownDescription: "The name of the storage profile.", - // }, - // }, - // } } func (d *catalogMediaDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { @@ -120,6 +73,8 @@ func (d *catalogMediaDataSource) Configure(ctx context.Context, req datasource.C } func (d *catalogMediaDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalog_media", d.client.GetOrgName(), metrics.Read)() + state := &catalogMediaDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/catalog/medias_datasource.go b/internal/provider/catalog/medias_datasource.go index eb4c1e36c..80c283cbd 100644 --- a/internal/provider/catalog/medias_datasource.go +++ b/internal/provider/catalog/medias_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -72,6 +73,8 @@ func (d *catalogMediasDataSource) Configure(ctx context.Context, req datasource. } func (d *catalogMediasDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_catalog_medias", d.client.GetOrgName(), metrics.Read)() + config := &catalogMediasDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/app_port_profile_resource.go b/internal/provider/edgegw/app_port_profile_resource.go index 793213fca..27d385250 100644 --- a/internal/provider/edgegw/app_port_profile_resource.go +++ b/internal/provider/edgegw/app_port_profile_resource.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" @@ -156,6 +157,8 @@ func (r *portProfilesResource) Configure(ctx context.Context, req resource.Confi // Create creates the resource and sets the initial Terraform state. func (r *portProfilesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_app_port_profile", r.client.GetOrgName(), metrics.Create)() + plan := &portProfilesResourceModel{} // Retrieve values from plan @@ -232,6 +235,8 @@ func (r *portProfilesResource) Create(ctx context.Context, req resource.CreateRe // Read refreshes the Terraform state with the latest data. func (r *portProfilesResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_app_port_profile", r.client.GetOrgName(), metrics.Read)() + state := &portProfilesResourceModel{} // Get current state @@ -287,6 +292,8 @@ func (r *portProfilesResource) Read(ctx context.Context, req resource.ReadReques // Update updates the resource and sets the updated Terraform state on success. func (r *portProfilesResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_app_port_profile", r.client.GetOrgName(), metrics.Update)() + var ( plan = &portProfilesResourceModel{} state = &portProfilesResourceModel{} @@ -378,6 +385,8 @@ func (r *portProfilesResource) Update(ctx context.Context, req resource.UpdateRe // Delete deletes the resource and removes the Terraform state on success. func (r *portProfilesResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_app_port_profile", r.client.GetOrgName(), metrics.Delete)() + state := &portProfilesResourceModel{} // Get current state diff --git a/internal/provider/edgegw/dhcp_forwarding_datasource.go b/internal/provider/edgegw/dhcp_forwarding_datasource.go index 75cafd1df..996d30891 100644 --- a/internal/provider/edgegw/dhcp_forwarding_datasource.go +++ b/internal/provider/edgegw/dhcp_forwarding_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -77,6 +78,8 @@ func (d *dhcpForwardingDataSource) Configure(ctx context.Context, req datasource } func (d *dhcpForwardingDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_dhcp_forwarding", d.client.GetOrgName(), metrics.Read)() + config := &DhcpForwardingModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/dhcp_forwarding_resource.go b/internal/provider/edgegw/dhcp_forwarding_resource.go index 698cf75d6..0138efd6a 100644 --- a/internal/provider/edgegw/dhcp_forwarding_resource.go +++ b/internal/provider/edgegw/dhcp_forwarding_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -91,6 +92,8 @@ func (r *dhcpForwardingResource) Configure(ctx context.Context, req resource.Con // Create creates the resource and sets the initial Terraform state. func (r *dhcpForwardingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_dhcp_forwarding", r.client.GetOrgName(), metrics.Create)() + plan := &DhcpForwardingModel{} // Retrieve values from plan @@ -133,6 +136,8 @@ func (r *dhcpForwardingResource) Create(ctx context.Context, req resource.Create // Read refreshes the Terraform state with the latest data. func (r *dhcpForwardingResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_dhcp_forwarding", r.client.GetOrgName(), metrics.Read)() + state := &DhcpForwardingModel{} // Get current state @@ -167,6 +172,8 @@ func (r *dhcpForwardingResource) Read(ctx context.Context, req resource.ReadRequ // Update updates the resource and sets the updated Terraform state on success. func (r *dhcpForwardingResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_dhcp_forwarding", r.client.GetOrgName(), metrics.Update)() + var ( plan = &DhcpForwardingModel{} state = &DhcpForwardingModel{} @@ -212,6 +219,8 @@ func (r *dhcpForwardingResource) Update(ctx context.Context, req resource.Update // Delete deletes the resource and removes the Terraform state on success. func (r *dhcpForwardingResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_dhcp_forwarding", r.client.GetOrgName(), metrics.Delete)() + state := &DhcpForwardingModel{} // Get current state @@ -252,6 +261,8 @@ func (r *dhcpForwardingResource) Delete(ctx context.Context, req resource.Delete } func (r *dhcpForwardingResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_dhcp_forwarding", r.client.GetOrgName(), metrics.Import)() + var ( edgegwID, edgegwName string d diag.Diagnostics diff --git a/internal/provider/edgegw/edgegateway_datasource.go b/internal/provider/edgegw/edgegateway_datasource.go index ca467e024..902d43930 100644 --- a/internal/provider/edgegw/edgegateway_datasource.go +++ b/internal/provider/edgegw/edgegateway_datasource.go @@ -13,6 +13,7 @@ import ( apiclient "github.com/orange-cloudavenue/cloudavenue-sdk-go" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -63,6 +64,7 @@ func (d *edgeGatewayDataSource) Read(ctx context.Context, req datasource.ReadReq data edgeGatewayDataSourceModel gateway apiclient.EdgeGateway ) + defer metrics.New("data.cloudavenue_edgegateway", d.client.GetOrgName(), metrics.Read)() // Read Terraform configuration data into the model resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) diff --git a/internal/provider/edgegw/edgegateway_resource.go b/internal/provider/edgegw/edgegateway_resource.go index ad056d0dd..bc38c7906 100644 --- a/internal/provider/edgegw/edgegateway_resource.go +++ b/internal/provider/edgegw/edgegateway_resource.go @@ -20,6 +20,7 @@ import ( apiclient "github.com/orange-cloudavenue/cloudavenue-sdk-go" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/cloudavenue" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" @@ -114,6 +115,8 @@ func (r *edgeGatewaysResource) Create( return } + defer metrics.New("cloudavenue_edgegateway", r.client.GetOrgName(), metrics.Create)() + // Create() is passed a default timeout to use if no value // has been supplied in the Terraform configuration. createTimeout, errTO := plan.Timeouts.Create(ctx, 8*time.Minute) @@ -282,6 +285,8 @@ func (r *edgeGatewaysResource) Read( return } + defer metrics.New("cloudavenue_edgegateway", r.client.GetOrgName(), metrics.Read)() + // Read timeout readTimeout, errTO := state.Timeouts.Read(ctx, 8*time.Minute) if errTO != nil { @@ -398,11 +403,12 @@ func (r *edgeGatewaysResource) Update( // Read Terraform plan data into the model resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { return } + defer metrics.New("cloudavenue_edgegateway", r.client.GetOrgName(), metrics.Update)() + // Update() is passed a default timeout to use if no value // has been supplied in the Terraform configuration. updateTimeout, errTO := plan.Timeouts.Update(ctx, 8*time.Minute) @@ -481,6 +487,8 @@ func (r *edgeGatewaysResource) Delete( return } + defer metrics.New("cloudavenue_edgegateway", r.client.GetOrgName(), metrics.Delete)() + cloudavenue.Lock(ctx) defer cloudavenue.Unlock(ctx) @@ -545,6 +553,8 @@ func (r *edgeGatewaysResource) ImportState( req resource.ImportStateRequest, resp *resource.ImportStateResponse, ) { + defer metrics.New("cloudavenue_edgegateway", r.client.GetOrgName(), metrics.Import)() + // Retrieve import Name and save to name attribute resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/edgegw/edgegateways_datasource.go b/internal/provider/edgegw/edgegateways_datasource.go index 909881bf3..a2db2fb15 100644 --- a/internal/provider/edgegw/edgegateways_datasource.go +++ b/internal/provider/edgegw/edgegateways_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -61,6 +62,8 @@ func (d *edgeGatewaysDataSource) Read(ctx context.Context, req datasource.ReadRe data = &edgeGatewaysDataSourceModel{} names []string ) + defer metrics.New("data.cloudavenue_edgegateways", d.client.GetOrgName(), metrics.Read)() + // Read Terraform configuration data into the model resp.Diagnostics.Append(req.Config.Get(ctx, data)...) if resp.Diagnostics.HasError() { diff --git a/internal/provider/edgegw/firewall_datasource.go b/internal/provider/edgegw/firewall_datasource.go index 8cc01e383..ca718b18c 100644 --- a/internal/provider/edgegw/firewall_datasource.go +++ b/internal/provider/edgegw/firewall_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -79,6 +80,8 @@ func (d *firewallDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *firewallDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_firewall", d.client.GetOrgName(), metrics.Read)() + config := &firewallModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/firewall_resource.go b/internal/provider/edgegw/firewall_resource.go index a01c1f208..ca783a34d 100644 --- a/internal/provider/edgegw/firewall_resource.go +++ b/internal/provider/edgegw/firewall_resource.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -235,6 +236,8 @@ func (r *firewallResource) Configure(ctx context.Context, req resource.Configure // Create creates the resource and sets the initial Terraform state. func (r *firewallResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { //nolint:dupl + defer metrics.New("cloudavenue_edgegateway_firewall", r.client.GetOrgName(), metrics.Create)() + plan := &firewallModel{} // Retrieve values from plan @@ -296,6 +299,8 @@ func (r *firewallResource) Create(ctx context.Context, req resource.CreateReques // Read refreshes the Terraform state with the latest data. func (r *firewallResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_firewall", r.client.GetOrgName(), metrics.Read)() + state := &firewallModel{} // Get current state @@ -326,6 +331,8 @@ func (r *firewallResource) Read(ctx context.Context, req resource.ReadRequest, r // Update updates the resource and sets the updated Terraform state on success. func (r *firewallResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { //nolint:dupl + defer metrics.New("cloudavenue_edgegateway_firewall", r.client.GetOrgName(), metrics.Update)() + plan := &firewallModel{} // Get current state @@ -385,6 +392,8 @@ func (r *firewallResource) Update(ctx context.Context, req resource.UpdateReques // Delete deletes the resource and removes the Terraform state on success. func (r *firewallResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_firewall", r.client.GetOrgName(), metrics.Delete)() + state := &firewallModel{} // Get current state @@ -425,6 +434,8 @@ func (r *firewallResource) Delete(ctx context.Context, req resource.DeleteReques } func (r *firewallResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_firewall", r.client.GetOrgName(), metrics.Import)() + var ( edgegwID string edgegwName string diff --git a/internal/provider/edgegw/ip_set_datasource.go b/internal/provider/edgegw/ip_set_datasource.go index 0a7ca1401..33d7808ef 100644 --- a/internal/provider/edgegw/ip_set_datasource.go +++ b/internal/provider/edgegw/ip_set_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -77,6 +78,8 @@ func (d *ipSetDataSource) Configure(ctx context.Context, req datasource.Configur } func (d *ipSetDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_ip_set", d.client.GetOrgName(), metrics.Read)() + config := &IPSetModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/ip_set_resource.go b/internal/provider/edgegw/ip_set_resource.go index 0a8944c83..0e7b26f71 100644 --- a/internal/provider/edgegw/ip_set_resource.go +++ b/internal/provider/edgegw/ip_set_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -94,6 +95,8 @@ func (r *ipSetResource) Configure(ctx context.Context, req resource.ConfigureReq // Create creates the resource and sets the initial Terraform state. func (r *ipSetResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_ip_set", r.client.GetOrgName(), metrics.Create)() + plan := &IPSetModel{} // Retrieve values from plan @@ -157,6 +160,8 @@ func (r *ipSetResource) Create(ctx context.Context, req resource.CreateRequest, // Read refreshes the Terraform state with the latest data. func (r *ipSetResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_ip_set", r.client.GetOrgName(), metrics.Read)() + state := &IPSetModel{} // Get current state @@ -196,6 +201,8 @@ func (r *ipSetResource) Update(ctx context.Context, req resource.UpdateRequest, state = &IPSetModel{} ) + defer metrics.New("cloudavenue_edgegateway_ip_set", r.client.GetOrgName(), metrics.Update)() + // Get current plan and state resp.Diagnostics.Append(req.Plan.Get(ctx, plan)...) resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -266,6 +273,8 @@ func (r *ipSetResource) Update(ctx context.Context, req resource.UpdateRequest, // Delete deletes the resource and removes the Terraform state on success. func (r *ipSetResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_ip_set", r.client.GetOrgName(), metrics.Delete)() + state := &IPSetModel{} // Get current state @@ -313,6 +322,8 @@ func (r *ipSetResource) Delete(ctx context.Context, req resource.DeleteRequest, } func (r *ipSetResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_ip_set", r.client.GetOrgName(), metrics.Import)() + // id format is edgeGatewayIDOrName.ipSetName idParts := strings.Split(req.ID, ".") diff --git a/internal/provider/edgegw/nat_rule_datasource.go b/internal/provider/edgegw/nat_rule_datasource.go index 8bd060f43..06955b91d 100644 --- a/internal/provider/edgegw/nat_rule_datasource.go +++ b/internal/provider/edgegw/nat_rule_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -77,6 +78,8 @@ func (d *natRuleDataSource) Configure(ctx context.Context, req datasource.Config } func (d *natRuleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_nat_rule", d.client.GetOrgName(), metrics.Read)() + config := &NATRuleModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/nat_rule_resource.go b/internal/provider/edgegw/nat_rule_resource.go index dd0bc3154..a151a66c2 100644 --- a/internal/provider/edgegw/nat_rule_resource.go +++ b/internal/provider/edgegw/nat_rule_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -91,6 +92,8 @@ func (r *natRuleResource) Configure(ctx context.Context, req resource.ConfigureR // Create creates the resource and sets the initial Terraform state. func (r *natRuleResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_nat_rule", r.client.GetOrgName(), metrics.Create)() + plan := &NATRuleModel{} // Retrieve values from plan @@ -153,6 +156,8 @@ func (r *natRuleResource) Create(ctx context.Context, req resource.CreateRequest // Read refreshes the Terraform state with the latest data. func (r *natRuleResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_nat_rule", r.client.GetOrgName(), metrics.Read)() + state := &NATRuleModel{} // Get current state @@ -188,6 +193,8 @@ func (r *natRuleResource) Read(ctx context.Context, req resource.ReadRequest, re // Update updates the resource and sets the updated Terraform state on success. func (r *natRuleResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_nat_rule", r.client.GetOrgName(), metrics.Update)() + var ( plan = &NATRuleModel{} state = &NATRuleModel{} @@ -258,6 +265,8 @@ func (r *natRuleResource) Update(ctx context.Context, req resource.UpdateRequest // Delete deletes the resource and removes the Terraform state on success. func (r *natRuleResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_nat_rule", r.client.GetOrgName(), metrics.Delete)() + state := &NATRuleModel{} // Get current state @@ -311,6 +320,8 @@ func (r *natRuleResource) ImportState(ctx context.Context, req resource.ImportSt natRule *govcd.NsxtNatRule ) + defer metrics.New("cloudavenue_edgegateway_nat_rule", r.client.GetOrgName(), metrics.Import)() + // Split req.ID with dot. ID format is EdgeGatewayIDOrName.NATRuleNameOrID idParts := strings.Split(req.ID, ".") diff --git a/internal/provider/edgegw/security_group_datasource.go b/internal/provider/edgegw/security_group_datasource.go index 92531ea3b..a53b8038a 100644 --- a/internal/provider/edgegw/security_group_datasource.go +++ b/internal/provider/edgegw/security_group_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -76,6 +77,8 @@ func (d *securityGroupDataSource) Configure(ctx context.Context, req datasource. } func (d *securityGroupDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_security_group", d.client.GetOrgName(), metrics.Read)() + config := &securityGroupModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/security_group_resource.go b/internal/provider/edgegw/security_group_resource.go index 3c4514dd4..44663c9f5 100644 --- a/internal/provider/edgegw/security_group_resource.go +++ b/internal/provider/edgegw/security_group_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -92,6 +93,8 @@ func (r *securityGroupResource) Configure(ctx context.Context, req resource.Conf // Create creates the resource and sets the initial Terraform state. func (r *securityGroupResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_security_group", r.client.GetOrgName(), metrics.Create)() + plan := &securityGroupModel{} // Retrieve values from plan @@ -143,6 +146,8 @@ func (r *securityGroupResource) Create(ctx context.Context, req resource.CreateR // Read refreshes the Terraform state with the latest data. func (r *securityGroupResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_security_group", r.client.GetOrgName(), metrics.Read)() + state := &securityGroupModel{} // Get current state @@ -183,6 +188,8 @@ func (r *securityGroupResource) Read(ctx context.Context, req resource.ReadReque // Update updates the resource and sets the updated Terraform state on success. func (r *securityGroupResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_security_group", r.client.GetOrgName(), metrics.Update)() + var ( plan = &securityGroupModel{} state = &securityGroupModel{} @@ -250,6 +257,8 @@ func (r *securityGroupResource) Update(ctx context.Context, req resource.UpdateR // Delete deletes the resource and removes the Terraform state on success. func (r *securityGroupResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_security_group", r.client.GetOrgName(), metrics.Delete)() + state := &securityGroupModel{} // Get current state @@ -291,6 +300,8 @@ func (r *securityGroupResource) Delete(ctx context.Context, req resource.DeleteR } func (r *securityGroupResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_security_group", r.client.GetOrgName(), metrics.Import)() + // id format is edgeGatewayIDOrName.securityGroupIDOrName idParts := strings.Split(req.ID, ".") diff --git a/internal/provider/edgegw/static_route_datasource.go b/internal/provider/edgegw/static_route_datasource.go index 9f76f55a4..663db46c9 100644 --- a/internal/provider/edgegw/static_route_datasource.go +++ b/internal/provider/edgegw/static_route_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -77,6 +78,8 @@ func (d *staticRouteDataSource) Configure(ctx context.Context, req datasource.Co } func (d *staticRouteDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_static_route", d.client.GetOrgName(), metrics.Read)() + config := &StaticRouteModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/static_route_resource.go b/internal/provider/edgegw/static_route_resource.go index 3d8b4f2ae..c3b68f864 100644 --- a/internal/provider/edgegw/static_route_resource.go +++ b/internal/provider/edgegw/static_route_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -91,6 +92,8 @@ func (r *staticRouteResource) Configure(ctx context.Context, req resource.Config // Create creates the resource and sets the initial Terraform state. func (r *staticRouteResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_static_route", r.client.GetOrgName(), metrics.Create)() + plan := &StaticRouteModel{} // Retrieve values from plan @@ -148,6 +151,8 @@ func (r *staticRouteResource) Create(ctx context.Context, req resource.CreateReq // Read refreshes the Terraform state with the latest data. func (r *staticRouteResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_static_route", r.client.GetOrgName(), metrics.Read)() + state := &StaticRouteModel{} // Get current state @@ -183,6 +188,8 @@ func (r *staticRouteResource) Read(ctx context.Context, req resource.ReadRequest // Update updates the resource and sets the updated Terraform state on success. func (r *staticRouteResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_static_route", r.client.GetOrgName(), metrics.Update)() + var ( plan = &StaticRouteModel{} state = &StaticRouteModel{} @@ -251,6 +258,8 @@ func (r *staticRouteResource) Update(ctx context.Context, req resource.UpdateReq // Delete deletes the resource and removes the Terraform state on success. func (r *staticRouteResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_static_route", r.client.GetOrgName(), metrics.Delete)() + state := &StaticRouteModel{} // Get current state @@ -296,6 +305,8 @@ func (r *staticRouteResource) Delete(ctx context.Context, req resource.DeleteReq } func (r *staticRouteResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_static_route", r.client.GetOrgName(), metrics.Import)() + var ( edgegwID, edgegwName string d diag.Diagnostics diff --git a/internal/provider/edgegw/vpn_ipsec_datasource.go b/internal/provider/edgegw/vpn_ipsec_datasource.go index 331a8abf5..9794981db 100644 --- a/internal/provider/edgegw/vpn_ipsec_datasource.go +++ b/internal/provider/edgegw/vpn_ipsec_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -76,6 +77,8 @@ func (d *vpnIpsecDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *vpnIpsecDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_edgegateway_vpn_ipsec", d.client.GetOrgName(), metrics.Read)() + config := &VPNIPSecModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/edgegw/vpn_ipsec_resource.go b/internal/provider/edgegw/vpn_ipsec_resource.go index e1ce7babf..9ac55a2d5 100644 --- a/internal/provider/edgegw/vpn_ipsec_resource.go +++ b/internal/provider/edgegw/vpn_ipsec_resource.go @@ -17,6 +17,7 @@ import ( supertypes "github.com/FrangipaneTeam/terraform-plugin-framework-supertypes" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -92,6 +93,8 @@ func (r *vpnIPSecResource) Configure(ctx context.Context, req resource.Configure // Create creates the resource and sets the initial Terraform state. func (r *vpnIPSecResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_edgegateway_vpn_ipsec", r.client.GetOrgName(), metrics.Create)() + plan := &VPNIPSecModel{} // Retrieve values from plan @@ -176,6 +179,8 @@ func (r *vpnIPSecResource) Create(ctx context.Context, req resource.CreateReques // Read refreshes the Terraform state with the latest data. func (r *vpnIPSecResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_edgegateway_vpn_ipsec", r.client.GetOrgName(), metrics.Read)() + state := &VPNIPSecModel{} // Get current state @@ -211,6 +216,8 @@ func (r *vpnIPSecResource) Read(ctx context.Context, req resource.ReadRequest, r // Update updates the resource and sets the updated Terraform state on success. func (r *vpnIPSecResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_edgegateway_vpn_ipsec", r.client.GetOrgName(), metrics.Update)() + var ( plan = &VPNIPSecModel{} state = &VPNIPSecModel{} @@ -300,6 +307,8 @@ func (r *vpnIPSecResource) Update(ctx context.Context, req resource.UpdateReques // Delete deletes the resource and removes the Terraform state on success. func (r *vpnIPSecResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_edgegateway_vpn_ipsec", r.client.GetOrgName(), metrics.Delete)() + state := &VPNIPSecModel{} // Get current state @@ -346,6 +355,8 @@ func (r *vpnIPSecResource) Delete(ctx context.Context, req resource.DeleteReques } func (r *vpnIPSecResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_edgegateway_vpn_ipsec", r.client.GetOrgName(), metrics.Import)() + var ( edgegwID, edgegwName string d diag.Diagnostics diff --git a/internal/provider/iam/right_datasource.go b/internal/provider/iam/right_datasource.go index 7010f727c..fd5f90a14 100644 --- a/internal/provider/iam/right_datasource.go +++ b/internal/provider/iam/right_datasource.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" ) var ( @@ -54,6 +55,8 @@ func (d *iamRightDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *iamRightDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_iam_right", d.client.GetOrgName(), metrics.Read)() + var data RightModel // Read Terraform configuration data into the model diff --git a/internal/provider/iam/role_datasource.go b/internal/provider/iam/role_datasource.go index 5cda869dc..b2d462489 100644 --- a/internal/provider/iam/role_datasource.go +++ b/internal/provider/iam/role_datasource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -73,6 +74,8 @@ func (d *roleDataSource) Configure(ctx context.Context, req datasource.Configure } func (d *roleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_iam_role", d.client.GetOrgName(), metrics.Read)() + var data *roleDataSourceModel // Read Terraform configuration data into the model diff --git a/internal/provider/iam/role_resource.go b/internal/provider/iam/role_resource.go index ab2d9a0ce..2a89599a8 100644 --- a/internal/provider/iam/role_resource.go +++ b/internal/provider/iam/role_resource.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -83,6 +84,8 @@ func (r *roleResource) Configure(ctx context.Context, req resource.ConfigureRequ // Create creates the resource and sets the initial Terraform state. func (r *roleResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_iam_role", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan plan := &roleResourceModel{} @@ -159,6 +162,8 @@ func (r *roleResource) Create(ctx context.Context, req resource.CreateRequest, r // Read refreshes the Terraform state with the latest data. func (r *roleResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_iam_role", r.client.GetOrgName(), metrics.Read)() + var state *roleResourceModel // Read state @@ -216,6 +221,8 @@ func (r *roleResource) Read(ctx context.Context, req resource.ReadRequest, resp } func (r *roleResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_iam_role", r.client.GetOrgName(), metrics.Delete)() + var ( state *roleResourceModel err error @@ -252,6 +259,8 @@ func (r *roleResource) Delete(ctx context.Context, req resource.DeleteRequest, r } func (r *roleResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_iam_role", r.client.GetOrgName(), metrics.Update)() + var ( plan, state *roleResourceModel err error @@ -354,6 +363,8 @@ func (r *roleResource) Update(ctx context.Context, req resource.UpdateRequest, r //go:generate tf-doc-extractor -filename $GOFILE -example-dir ../../../examples -resource func (r *roleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_iam_role", r.client.GetOrgName(), metrics.Import)() + resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/iam/token_resource.go b/internal/provider/iam/token_resource.go index 5186df751..2fb318aaa 100644 --- a/internal/provider/iam/token_resource.go +++ b/internal/provider/iam/token_resource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -67,6 +68,8 @@ func (r *tokenResource) Configure(ctx context.Context, req resource.ConfigureReq // Create creates the resource and sets the initial Terraform state. func (r *tokenResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_iam_token", r.client.GetOrgName(), metrics.Create)() + plan := &TokenModel{} // Retrieve values from plan @@ -130,6 +133,8 @@ func (r *tokenResource) Create(ctx context.Context, req resource.CreateRequest, // Read refreshes the Terraform state with the latest data. func (r *tokenResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_iam_token", r.client.GetOrgName(), metrics.Read)() + state := &TokenModel{} // Get current state @@ -171,6 +176,8 @@ func (r *tokenResource) Update(ctx context.Context, req resource.UpdateRequest, // Delete deletes the resource and removes the Terraform state on success. func (r *tokenResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_iam_token", r.client.GetOrgName(), metrics.Delete)() + state := &TokenModel{} // Get current state diff --git a/internal/provider/iam/user_datasource.go b/internal/provider/iam/user_datasource.go index 7403a841c..54b256012 100644 --- a/internal/provider/iam/user_datasource.go +++ b/internal/provider/iam/user_datasource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" ) @@ -77,6 +78,8 @@ func (d *userDataSource) Configure(ctx context.Context, req datasource.Configure // Read reads the data source. func (d *userDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_iam_user", d.client.GetOrgName(), metrics.Read)() + config := &userDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/iam/user_resource.go b/internal/provider/iam/user_resource.go index 15d826d99..1c4c8f284 100644 --- a/internal/provider/iam/user_resource.go +++ b/internal/provider/iam/user_resource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -81,6 +82,8 @@ func (r *userResource) Init(_ context.Context, rm *userResourceModel) (diags dia // Create creates the resource and sets the initial Terraform state. func (r *userResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_iam_user", r.client.GetOrgName(), metrics.Create)() + plan := &userResourceModel{} resp.Diagnostics.Append(req.Plan.Get(ctx, plan)...) @@ -123,6 +126,8 @@ func (r *userResource) Create(ctx context.Context, req resource.CreateRequest, r // Read refreshes the Terraform state with the latest data. func (r *userResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_iam_user", r.client.GetOrgName(), metrics.Read)() + state := &userResourceModel{} // Get current state @@ -169,6 +174,8 @@ func (r *userResource) Read(ctx context.Context, req resource.ReadRequest, resp // Update updates the resource and sets the updated Terraform state on success. func (r *userResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_iam_user", r.client.GetOrgName(), metrics.Update)() + plan := &userResourceModel{} // Get current state @@ -213,6 +220,8 @@ func (r *userResource) Update(ctx context.Context, req resource.UpdateRequest, r // Delete deletes the resource and removes the Terraform state on success. func (r *userResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_iam_user", r.client.GetOrgName(), metrics.Delete)() + state := &userResourceModel{} // Get current state @@ -242,6 +251,7 @@ func (r *userResource) Delete(ctx context.Context, req resource.DeleteRequest, r } func (r *userResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_iam_user", r.client.GetOrgName(), metrics.Import)() resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/network/dhcp_binding_datasource.go b/internal/provider/network/dhcp_binding_datasource.go index 5ea4d974a..513f1d04a 100644 --- a/internal/provider/network/dhcp_binding_datasource.go +++ b/internal/provider/network/dhcp_binding_datasource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -58,6 +59,8 @@ func (d *dhcpBindingDataSource) Configure(ctx context.Context, req datasource.Co } func (d *dhcpBindingDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_network_dhcp_binding", d.client.GetOrgName(), metrics.Read)() + config := &DHCPBindingModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/network/dhcp_binding_resource.go b/internal/provider/network/dhcp_binding_resource.go index 164a2bd56..8838ddf58 100644 --- a/internal/provider/network/dhcp_binding_resource.go +++ b/internal/provider/network/dhcp_binding_resource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -72,6 +73,8 @@ func (r *dhcpBindingResource) Configure(ctx context.Context, req resource.Config // Create creates the resource and sets the initial Terraform state. func (r *dhcpBindingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_network_dhcp_binding", r.client.GetOrgName(), metrics.Create)() + plan := &DHCPBindingModel{} // Retrieve values from plan @@ -130,6 +133,8 @@ func (r *dhcpBindingResource) Create(ctx context.Context, req resource.CreateReq // Read refreshes the Terraform state with the latest data. func (r *dhcpBindingResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_network_dhcp_binding", r.client.GetOrgName(), metrics.Read)() + state := &DHCPBindingModel{} // Get current state @@ -165,6 +170,8 @@ func (r *dhcpBindingResource) Read(ctx context.Context, req resource.ReadRequest // Update updates the resource and sets the updated Terraform state on success. func (r *dhcpBindingResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_network_dhcp_binding", r.client.GetOrgName(), metrics.Update)() + var ( plan = &DHCPBindingModel{} state = &DHCPBindingModel{} @@ -225,6 +232,8 @@ func (r *dhcpBindingResource) Update(ctx context.Context, req resource.UpdateReq // Delete deletes the resource and removes the Terraform state on success. func (r *dhcpBindingResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_network_dhcp_binding", r.client.GetOrgName(), metrics.Delete)() + state := &DHCPBindingModel{} // Get current state @@ -316,6 +325,8 @@ func (r *dhcpBindingResource) read(ctx context.Context, planOrState *DHCPBinding // ImportState imports a resource from orgNetworkID.DhcpBindingName. func (r *dhcpBindingResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_network_dhcp_binding", r.client.GetOrgName(), metrics.Import)() + // Init the resource resp.Diagnostics.Append(r.Init(ctx, nil)...) if resp.Diagnostics.HasError() { diff --git a/internal/provider/network/dhcp_datasource.go b/internal/provider/network/dhcp_datasource.go index 28775342e..60de32b81 100644 --- a/internal/provider/network/dhcp_datasource.go +++ b/internal/provider/network/dhcp_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" ) @@ -64,6 +65,8 @@ func (d *dhcpDataSource) Configure(ctx context.Context, req datasource.Configure } func (d *dhcpDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_network_dhcp", d.client.GetOrgName(), metrics.Read)() + config := &dhcpModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/network/dhcp_resource.go b/internal/provider/network/dhcp_resource.go index 13f3b68f6..674e67887 100644 --- a/internal/provider/network/dhcp_resource.go +++ b/internal/provider/network/dhcp_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" @@ -73,6 +74,8 @@ func (r *dhcpResource) Configure(ctx context.Context, req resource.ConfigureRequ // Create creates the resource and sets the initial Terraform state. func (r *dhcpResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_network_dhcp", r.client.GetOrgName(), metrics.Create)() + plan := &dhcpModel{} // Retrieve values from plan @@ -116,6 +119,8 @@ func (r *dhcpResource) Create(ctx context.Context, req resource.CreateRequest, r // Read refreshes the Terraform state with the latest data. func (r *dhcpResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_network_dhcp", r.client.GetOrgName(), metrics.Read)() + state := &dhcpModel{} // Get current state @@ -154,6 +159,8 @@ func (r *dhcpResource) Read(ctx context.Context, req resource.ReadRequest, resp // Update updates the resource and sets the updated Terraform state on success. func (r *dhcpResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_network_dhcp", r.client.GetOrgName(), metrics.Update)() + var ( plan = &dhcpModel{} state = &dhcpModel{} @@ -199,6 +206,8 @@ func (r *dhcpResource) Update(ctx context.Context, req resource.UpdateRequest, r // Delete deletes the resource and removes the Terraform state on success. func (r *dhcpResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_network_dhcp", r.client.GetOrgName(), metrics.Delete)() + state := &dhcpModel{} // Get current state @@ -226,6 +235,8 @@ func (r *dhcpResource) Delete(ctx context.Context, req resource.DeleteRequest, r } func (r *dhcpResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_network_dhcp", r.client.GetOrgName(), metrics.Import)() + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("org_network_id"), req.ID)...) } diff --git a/internal/provider/network/isolated_datasource.go b/internal/provider/network/isolated_datasource.go index ddbd46626..a96618a63 100644 --- a/internal/provider/network/isolated_datasource.go +++ b/internal/provider/network/isolated_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" ) @@ -56,6 +57,8 @@ func (d *networkIsolatedDataSource) Configure(ctx context.Context, req datasourc } func (d *networkIsolatedDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_network_isolated", d.client.GetOrgName(), metrics.Read)() + var data networkIsolatedModel // Read Terraform configuration data into the model diff --git a/internal/provider/network/isolated_resource.go b/internal/provider/network/isolated_resource.go index 09ffa6769..6e3251a8a 100644 --- a/internal/provider/network/isolated_resource.go +++ b/internal/provider/network/isolated_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/mutex" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -106,6 +107,8 @@ func (r *networkIsolatedResource) Configure(ctx context.Context, req resource.Co // Create creates the resource and sets the initial Terraform state. func (r *networkIsolatedResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_network_isolated", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan plan := &networkIsolatedModel{} resp.Diagnostics.Append(req.Plan.Get(ctx, plan)...) @@ -158,6 +161,8 @@ func (r *networkIsolatedResource) Create(ctx context.Context, req resource.Creat // Read refreshes the Terraform state with the latest data. func (r *networkIsolatedResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_network_isolated", r.client.GetOrgName(), metrics.Read)() + // Get current state state := &networkIsolatedModel{} resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -231,6 +236,8 @@ func (r *networkIsolatedResource) Read(ctx context.Context, req resource.ReadReq // Update updates the resource and sets the updated Terraform state on success. func (r *networkIsolatedResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_network_isolated", r.client.GetOrgName(), metrics.Update)() + // Get current state plan := &networkIsolatedModel{} resp.Diagnostics.Append(req.Plan.Get(ctx, plan)...) @@ -293,6 +300,8 @@ func (r *networkIsolatedResource) Update(ctx context.Context, req resource.Updat // Delete deletes the resource and removes the Terraform state on success. func (r *networkIsolatedResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_network_isolated", r.client.GetOrgName(), metrics.Delete)() + // Get current state state := &networkIsolatedModel{} resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -339,6 +348,8 @@ func (r *networkIsolatedResource) Delete(ctx context.Context, req resource.Delet } func (r *networkIsolatedResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_network_isolated", r.client.GetOrgName(), metrics.Import)() + // Get URI from import ID resourceURI := strings.Split(req.ID, ".") if len(resourceURI) != 2 { diff --git a/internal/provider/network/routed_datasource.go b/internal/provider/network/routed_datasource.go index de8167d42..fd97fcc66 100644 --- a/internal/provider/network/routed_datasource.go +++ b/internal/provider/network/routed_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -70,6 +71,8 @@ func (d *networkRoutedDataSource) Configure(ctx context.Context, req datasource. } func (d *networkRoutedDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_network_routed", d.client.GetOrgName(), metrics.Read)() + var data networkRoutedModel // Read Terraform configuration data into the model diff --git a/internal/provider/network/routed_resource.go b/internal/provider/network/routed_resource.go index 6e46e8fe4..804c50341 100644 --- a/internal/provider/network/routed_resource.go +++ b/internal/provider/network/routed_resource.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" @@ -84,6 +85,8 @@ func (r *networkRoutedResource) Configure(ctx context.Context, req resource.Conf // Create creates the resource and sets the initial Terraform state. func (r *networkRoutedResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_network_routed", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan plan := &networkRoutedModel{} @@ -142,6 +145,8 @@ func (r *networkRoutedResource) Create(ctx context.Context, req resource.CreateR // Read refreshes the Terraform state with the latest data. func (r *networkRoutedResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_network_routed", r.client.GetOrgName(), metrics.Read)() + state := &networkRoutedModel{} // Get current state resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -191,6 +196,8 @@ func (r *networkRoutedResource) Read(ctx context.Context, req resource.ReadReque // Update updates the resource and sets the updated Terraform state on success. func (r *networkRoutedResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_network_routed", r.client.GetOrgName(), metrics.Update)() + plan := &networkRoutedModel{} // Get current state @@ -255,6 +262,8 @@ func (r *networkRoutedResource) Update(ctx context.Context, req resource.UpdateR // Delete deletes the resource and removes the Terraform state on success. func (r *networkRoutedResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_network_routed", r.client.GetOrgName(), metrics.Delete)() + state := &networkRoutedModel{} // Get current state @@ -307,6 +316,8 @@ func (r *networkRoutedResource) Delete(ctx context.Context, req resource.DeleteR } func (r *networkRoutedResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_network_routed", r.client.GetOrgName(), metrics.Import)() + resourceURI := strings.Split(req.ID, ".") if len(resourceURI) != 2 { diff --git a/internal/provider/publicip/publicip_resource.go b/internal/provider/publicip/publicip_resource.go index fbe0633a3..5da165fa6 100644 --- a/internal/provider/publicip/publicip_resource.go +++ b/internal/provider/publicip/publicip_resource.go @@ -22,6 +22,7 @@ import ( apiclient "github.com/orange-cloudavenue/cloudavenue-sdk-go" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/cloudavenue" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" @@ -82,6 +83,8 @@ func (r *publicIPResource) Configure(ctx context.Context, req resource.Configure // Create creates the resource and sets the initial Terraform state. func (r *publicIPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_publicip", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan plan := &publicIPResourceModel{} @@ -261,6 +264,8 @@ func (r *publicIPResource) Create(ctx context.Context, req resource.CreateReques // Read refreshes the Terraform state with the latest data. func (r *publicIPResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_publicip", r.client.GetOrgName(), metrics.Read)() + state := &publicIPResourceModel{} resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -350,6 +355,8 @@ func (r *publicIPResource) Update(ctx context.Context, req resource.UpdateReques // Delete deletes the resource and removes the Terraform state on success. func (r *publicIPResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_publicip", r.client.GetOrgName(), metrics.Delete)() + state := &publicIPResourceModel{} resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -420,6 +427,8 @@ func (r *publicIPResource) Delete(ctx context.Context, req resource.DeleteReques } func (r *publicIPResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_publicip", r.client.GetOrgName(), metrics.Import)() + // Retrieve import ID and save to id attribute resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/internal/provider/publicip/publicips_datasource.go b/internal/provider/publicip/publicips_datasource.go index b84d4df98..5d6d74551 100644 --- a/internal/provider/publicip/publicips_datasource.go +++ b/internal/provider/publicip/publicips_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/edgegw" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" @@ -69,6 +70,8 @@ func (d *publicIPDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *publicIPDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_publicips", d.client.GetOrgName(), metrics.Read)() + data := &publicIPDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/storage/profile_datasource.go b/internal/provider/storage/profile_datasource.go index d8a0d31f3..d75dc1e62 100644 --- a/internal/provider/storage/profile_datasource.go +++ b/internal/provider/storage/profile_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" ) @@ -67,6 +68,8 @@ func (d *profileDataSource) Configure(ctx context.Context, req datasource.Config } func (d *profileDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_storage_profile", d.client.GetOrgName(), metrics.Read)() + config := &profileDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/storage/profiles_datasource.go b/internal/provider/storage/profiles_datasource.go index eb5aae720..b2f2109d7 100644 --- a/internal/provider/storage/profiles_datasource.go +++ b/internal/provider/storage/profiles_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -78,6 +79,8 @@ func (d *profilesDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *profilesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_storage_profiles", d.client.GetOrgName(), metrics.Read)() + config := &profilesDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/vapp/acl_resource.go b/internal/provider/vapp/acl_resource.go index 391f5f942..0bc7ff140 100644 --- a/internal/provider/vapp/acl_resource.go +++ b/internal/provider/vapp/acl_resource.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/acl" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -82,6 +83,8 @@ func (r *aclResource) Configure(ctx context.Context, req resource.ConfigureReque // Create creates the resource and sets the initial Terraform state. func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vapp_acl", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *aclResourceModel @@ -113,6 +116,8 @@ func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, re // Read refreshes the Terraform state with the latest data. func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vapp_acl", r.client.GetOrgName(), metrics.Read)() + var state *aclResourceModel // Get current state @@ -182,6 +187,8 @@ func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp * // Update updates the resource and sets the updated Terraform state on success. func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vapp_acl", r.client.GetOrgName(), metrics.Update)() + var plan *aclResourceModel // Get current state @@ -211,6 +218,8 @@ func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, re // Delete deletes the resource and removes the Terraform state on success. func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vapp_acl", r.client.GetOrgName(), metrics.Delete)() + var state *aclResourceModel // Get current state @@ -240,6 +249,8 @@ func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, re } func (r *aclResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vapp_acl", r.client.GetOrgName(), metrics.Import)() + idParts := strings.Split(req.ID, ".") if len(idParts) != 1 && len(idParts) != 2 { diff --git a/internal/provider/vapp/isolated_network_datasource.go b/internal/provider/vapp/isolated_network_datasource.go index 3aa1b6000..60100ef8e 100644 --- a/internal/provider/vapp/isolated_network_datasource.go +++ b/internal/provider/vapp/isolated_network_datasource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" @@ -85,6 +86,8 @@ func (d *isolatedNetworkDataSource) Configure(ctx context.Context, req datasourc } func (d *isolatedNetworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vapp_isolated_network", d.client.GetOrgName(), metrics.Read)() + var ( config = &isolatedNetworkDataSourceModel{} diag diag.Diagnostics diff --git a/internal/provider/vapp/isolated_network_resource.go b/internal/provider/vapp/isolated_network_resource.go index 52603c290..64cef7db9 100644 --- a/internal/provider/vapp/isolated_network_resource.go +++ b/internal/provider/vapp/isolated_network_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" @@ -91,6 +92,8 @@ func (r *isolatedNetworkResource) Configure(ctx context.Context, req resource.Co // Create creates the resource and sets the initial Terraform state. func (r *isolatedNetworkResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vapp_isolated_network", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *isolatedNetworkResourceModel @@ -185,6 +188,8 @@ func (r *isolatedNetworkResource) Create(ctx context.Context, req resource.Creat // Read refreshes the Terraform state with the latest data. func (r *isolatedNetworkResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vapp_isolated_network", r.client.GetOrgName(), metrics.Read)() + var ( state *isolatedNetworkResourceModel diag diag.Diagnostics @@ -278,6 +283,8 @@ func (r *isolatedNetworkResource) Read(ctx context.Context, req resource.ReadReq // Update updates the resource and sets the updated Terraform state on success. func (r *isolatedNetworkResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vapp_isolated_network", r.client.GetOrgName(), metrics.Update)() + var plan *isolatedNetworkResourceModel // Get current state @@ -345,6 +352,8 @@ func (r *isolatedNetworkResource) Update(ctx context.Context, req resource.Updat // Delete deletes the resource and removes the Terraform state on success. func (r *isolatedNetworkResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vapp_isolated_network", r.client.GetOrgName(), metrics.Delete)() + var state *isolatedNetworkResourceModel // Get current state @@ -374,6 +383,8 @@ func (r *isolatedNetworkResource) Delete(ctx context.Context, req resource.Delet } func (r *isolatedNetworkResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vapp_isolated_network", r.client.GetOrgName(), metrics.Import)() + idParts := strings.Split(req.ID, ".") if len(idParts) != 3 && len(idParts) != 2 { diff --git a/internal/provider/vapp/org_network_datasource.go b/internal/provider/vapp/org_network_datasource.go index a04899913..70ef22458 100644 --- a/internal/provider/vapp/org_network_datasource.go +++ b/internal/provider/vapp/org_network_datasource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" @@ -84,6 +85,8 @@ func (d *orgNetworkDataSource) Configure(ctx context.Context, req datasource.Con } func (d *orgNetworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vapp_org_network", d.client.GetOrgName(), metrics.Read)() + var data *orgNetworkModel // Read Terraform configuration data into the model diff --git a/internal/provider/vapp/org_network_resource.go b/internal/provider/vapp/org_network_resource.go index 02149b4cb..f23cc9fc4 100644 --- a/internal/provider/vapp/org_network_resource.go +++ b/internal/provider/vapp/org_network_resource.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/network" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -87,6 +88,8 @@ func (r *orgNetworkResource) Configure(ctx context.Context, req resource.Configu // Create creates the resource and sets the initial Terraform state. func (r *orgNetworkResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vapp_org_network", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *orgNetworkModel @@ -164,6 +167,8 @@ func (r *orgNetworkResource) Create(ctx context.Context, req resource.CreateRequ // Read refreshes the Terraform state with the latest data. func (r *orgNetworkResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vapp_org_network", r.client.GetOrgName(), metrics.Read)() + var state *orgNetworkModel // Get current state @@ -225,6 +230,8 @@ func (r *orgNetworkResource) Read(ctx context.Context, req resource.ReadRequest, // Update updates the resource and sets the updated Terraform state on success. func (r *orgNetworkResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vapp_org_network", r.client.GetOrgName(), metrics.Update)() + var plan, state *orgNetworkModel // Get current state @@ -299,6 +306,8 @@ func (r *orgNetworkResource) Update(ctx context.Context, req resource.UpdateRequ // Delete deletes the resource and removes the Terraform state on success. func (r *orgNetworkResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vapp_org_network", r.client.GetOrgName(), metrics.Delete)() + var state *orgNetworkModel // Get current state @@ -388,6 +397,8 @@ func (r *orgNetworkResource) Delete(ctx context.Context, req resource.DeleteRequ } func (r *orgNetworkResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vapp_org_network", r.client.GetOrgName(), metrics.Import)() + var state *orgNetworkModel resourceURI := strings.Split(req.ID, ".") diff --git a/internal/provider/vapp/vapp_datasource.go b/internal/provider/vapp/vapp_datasource.go index 979c01235..412a8764f 100644 --- a/internal/provider/vapp/vapp_datasource.go +++ b/internal/provider/vapp/vapp_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" ) @@ -71,6 +72,8 @@ func (d *vappDataSource) Configure(ctx context.Context, req datasource.Configure } func (d *vappDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vapp", d.client.GetOrgName(), metrics.Read)() + var data vappResourceModel // Read Terraform configuration data into the model diff --git a/internal/provider/vapp/vapp_resource.go b/internal/provider/vapp/vapp_resource.go index 8d55e1f93..60051cb46 100644 --- a/internal/provider/vapp/vapp_resource.go +++ b/internal/provider/vapp/vapp_resource.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -91,6 +92,8 @@ func (r *vappResource) Configure(ctx context.Context, req resource.ConfigureRequ // Create creates the resource and sets the initial Terraform state. func (r *vappResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vapp", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *vappResourceModel @@ -152,6 +155,8 @@ func (r *vappResource) Create(ctx context.Context, req resource.CreateRequest, r // Read refreshes the Terraform state with the latest data. func (r *vappResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vapp", r.client.GetOrgName(), metrics.Read)() + var ( state *vappResourceModel diags diag.Diagnostics @@ -228,6 +233,8 @@ func (r *vappResource) Read(ctx context.Context, req resource.ReadRequest, resp // Update updates the resource and sets the updated Terraform state on success. func (r *vappResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vapp", r.client.GetOrgName(), metrics.Update)() + var ( plan, state *vappResourceModel diags diag.Diagnostics @@ -265,6 +272,8 @@ func (r *vappResource) Update(ctx context.Context, req resource.UpdateRequest, r // Delete deletes the resource and removes the Terraform state on success. func (r *vappResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vapp", r.client.GetOrgName(), metrics.Delete)() + // Get current state var state *vappResourceModel diags := req.State.Get(ctx, &state) @@ -321,6 +330,8 @@ func (r *vappResource) Delete(ctx context.Context, req resource.DeleteRequest, r } func (r *vappResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vapp", r.client.GetOrgName(), metrics.Import)() + // Retrieve import ID and save to id attribute resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/vcda/vcda_ip_resource.go b/internal/provider/vcda/vcda_ip_resource.go index ddd693525..2db52d003 100644 --- a/internal/provider/vcda/vcda_ip_resource.go +++ b/internal/provider/vcda/vcda_ip_resource.go @@ -15,6 +15,7 @@ import ( "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/cloudavenue" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" @@ -70,6 +71,8 @@ func (r *vcdaIPResource) Configure(ctx context.Context, req resource.ConfigureRe // Create creates the resource and sets the initial Terraform state. func (r *vcdaIPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vcda_ip", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var plan *vcdaIPResourceModel @@ -109,6 +112,8 @@ func (r *vcdaIPResource) Create(ctx context.Context, req resource.CreateRequest, // Read refreshes the Terraform state with the latest data. func (r *vcdaIPResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vcda_ip", r.client.GetOrgName(), metrics.Read)() + // Get current state var state *vcdaIPResourceModel @@ -148,6 +153,8 @@ func (r *vcdaIPResource) Update(ctx context.Context, req resource.UpdateRequest, // Delete deletes the resource and removes the Terraform state on success. func (r *vcdaIPResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vcda_ip", r.client.GetOrgName(), metrics.Delete)() + /// Get current state var state *vcdaIPResourceModel diff --git a/internal/provider/vdc/acl_resource.go b/internal/provider/vdc/acl_resource.go index aca76f5fd..6f80be15d 100644 --- a/internal/provider/vdc/acl_resource.go +++ b/internal/provider/vdc/acl_resource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/acl" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" ) @@ -77,6 +78,8 @@ func (r *aclResource) Configure(ctx context.Context, req resource.ConfigureReque // Create creates the resource and sets the initial Terraform state. func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vdc_acl", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *aclResourceModel @@ -108,6 +111,8 @@ func (r *aclResource) Create(ctx context.Context, req resource.CreateRequest, re // Read refreshes the Terraform state with the latest data. func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vdc_acl", r.client.GetOrgName(), metrics.Read)() + var state *aclResourceModel // Get current state @@ -175,6 +180,8 @@ func (r *aclResource) Read(ctx context.Context, req resource.ReadRequest, resp * // Update updates the resource and sets the updated Terraform state on success. func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vdc_acl", r.client.GetOrgName(), metrics.Update)() + var plan *aclResourceModel // Get current state @@ -204,6 +211,8 @@ func (r *aclResource) Update(ctx context.Context, req resource.UpdateRequest, re // Delete deletes the resource and removes the Terraform state on success. func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vdc_acl", r.client.GetOrgName(), metrics.Delete)() + var state *aclResourceModel // Get current state @@ -227,6 +236,8 @@ func (r *aclResource) Delete(ctx context.Context, req resource.DeleteRequest, re //go:generate tf-doc-extractor -filename $GOFILE -example-dir ../../../examples -resource func (r *aclResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vdc_acl", r.client.GetOrgName(), metrics.Import)() + resource.ImportStatePassthroughID(ctx, path.Root("vdc"), req, resp) } diff --git a/internal/provider/vdc/vdc_datasource.go b/internal/provider/vdc/vdc_datasource.go index e11f48efc..bcd5b9c99 100644 --- a/internal/provider/vdc/vdc_datasource.go +++ b/internal/provider/vdc/vdc_datasource.go @@ -12,6 +12,7 @@ import ( "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -58,6 +59,8 @@ func (d *vdcDataSource) Configure(ctx context.Context, req datasource.ConfigureR } func (d *vdcDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vdc", d.client.GetOrgName(), metrics.Read)() + var data vdcDataSourceModel // Read Terraform configuration data into the model diff --git a/internal/provider/vdc/vdc_group_datasource.go b/internal/provider/vdc/vdc_group_datasource.go index 8df1c0115..59182d192 100644 --- a/internal/provider/vdc/vdc_group_datasource.go +++ b/internal/provider/vdc/vdc_group_datasource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" ) const vdcStatuses = "`SAVING`, `SAVED`, `CONFIGURING`, `REALIZED`, `REALIZATION_FAILED`," + @@ -151,6 +152,8 @@ func (d *vdcGroupDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *vdcGroupDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vdc_group", d.client.GetOrgName(), metrics.Read)() + var ( data vdcGroupDataSourceModel diag diag.Diagnostics diff --git a/internal/provider/vdc/vdc_group_resource.go b/internal/provider/vdc/vdc_group_resource.go index 6ce16dfd1..b1b9d0bbd 100644 --- a/internal/provider/vdc/vdc_group_resource.go +++ b/internal/provider/vdc/vdc_group_resource.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminorg" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -70,6 +71,8 @@ func (r *groupResource) Configure(ctx context.Context, req resource.ConfigureReq // Create creates the resource and sets the initial Terraform state. func (r *groupResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vdc_group", r.client.GetOrgName(), metrics.Create)() + plan := &GroupModel{} // Retrieve values from plan @@ -113,6 +116,8 @@ func (r *groupResource) Create(ctx context.Context, req resource.CreateRequest, // Read refreshes the Terraform state with the latest data. func (r *groupResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vdc_group", r.client.GetOrgName(), metrics.Read)() + state := &GroupModel{} // Get current state @@ -147,6 +152,8 @@ func (r *groupResource) Read(ctx context.Context, req resource.ReadRequest, resp // Update updates the resource and sets the updated Terraform state on success. func (r *groupResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vdc_group", r.client.GetOrgName(), metrics.Update)() + var ( plan = &GroupModel{} state = &GroupModel{} @@ -199,6 +206,8 @@ func (r *groupResource) Update(ctx context.Context, req resource.UpdateRequest, // Delete deletes the resource and removes the Terraform state on success. func (r *groupResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vdc_group", r.client.GetOrgName(), metrics.Delete)() + state := &GroupModel{} // Get current state @@ -230,6 +239,8 @@ func (r *groupResource) Delete(ctx context.Context, req resource.DeleteRequest, } func (r *groupResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vdc_group", r.client.GetOrgName(), metrics.Import)() + // id format is vdcGroupIDOrName var ( diff --git a/internal/provider/vdc/vdc_resource.go b/internal/provider/vdc/vdc_resource.go index be6ce3591..9eb3016d1 100644 --- a/internal/provider/vdc/vdc_resource.go +++ b/internal/provider/vdc/vdc_resource.go @@ -20,6 +20,7 @@ import ( apiclient "github.com/orange-cloudavenue/cloudavenue-sdk-go" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/helpers" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/cloudavenue" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" ) @@ -74,6 +75,8 @@ func (r *vdcResource) Configure(ctx context.Context, req resource.ConfigureReque // Create creates the resource and sets the initial Terraform state. func (r *vdcResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vdc", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var plan *vdcResourceModel @@ -197,6 +200,8 @@ func (r *vdcResource) Create(ctx context.Context, req resource.CreateRequest, re // Read refreshes the Terraform state with the latest data. func (r *vdcResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vdc", r.client.GetOrgName(), metrics.Read)() + // Get current state var state *vdcResourceModel @@ -305,6 +310,8 @@ func (r *vdcResource) Read(ctx context.Context, req resource.ReadRequest, resp * // Update updates the resource and sets the updated Terraform state on success. func (r *vdcResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vdc", r.client.GetOrgName(), metrics.Update)() + var plan *vdcResourceModel // Read Terraform plan data into the model @@ -407,6 +414,8 @@ func (r *vdcResource) Update(ctx context.Context, req resource.UpdateRequest, re // Delete deletes the resource and removes the Terraform state on success. func (r *vdcResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vdc", r.client.GetOrgName(), metrics.Delete)() + var state *vdcResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -474,6 +483,8 @@ func (r *vdcResource) Delete(ctx context.Context, req resource.DeleteRequest, re } func (r *vdcResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vdc", r.client.GetOrgName(), metrics.Import)() + // Retrieve import ID and save to id attribute resource.ImportStatePassthroughID(ctx, path.Root("name"), req, resp) } diff --git a/internal/provider/vdc/vdcs_datasource.go b/internal/provider/vdc/vdcs_datasource.go index 8c9422cb1..374473078 100644 --- a/internal/provider/vdc/vdcs_datasource.go +++ b/internal/provider/vdc/vdcs_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -57,6 +58,8 @@ func (d *vdcsDataSource) Configure(ctx context.Context, req datasource.Configure } func (d *vdcsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vdcs", d.client.GetOrgName(), metrics.Read)() + var ( data vdcsDataSourceModel names []string diff --git a/internal/provider/vm/inserted_media_resource.go b/internal/provider/vm/inserted_media_resource.go index 90b80e087..39e13665a 100644 --- a/internal/provider/vm/inserted_media_resource.go +++ b/internal/provider/vm/inserted_media_resource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -84,6 +85,8 @@ func (r *insertedMediaResource) Configure(ctx context.Context, req resource.Conf // Create creates the resource and sets the initial Terraform state. func (r *insertedMediaResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vm_inserted_media", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *insertedMediaResourceModel @@ -129,6 +132,8 @@ func (r *insertedMediaResource) Create(ctx context.Context, req resource.CreateR // Read refreshes the Terraform state with the latest data. func (r *insertedMediaResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vm_inserted_media", r.client.GetOrgName(), metrics.Read)() + var state *insertedMediaResourceModel // Get current state @@ -230,6 +235,8 @@ func (r *insertedMediaResource) Update(ctx context.Context, req resource.UpdateR // Delete deletes the resource and removes the Terraform state on success. func (r *insertedMediaResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vm_inserted_media", r.client.GetOrgName(), metrics.Delete)() + var state *insertedMediaResourceModel // Get current state diff --git a/internal/provider/vm/vm_affinity_rule_datasource.go b/internal/provider/vm/vm_affinity_rule_datasource.go index 5c75391fc..e86ea6ae2 100644 --- a/internal/provider/vm/vm_affinity_rule_datasource.go +++ b/internal/provider/vm/vm_affinity_rule_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" ) @@ -63,6 +64,8 @@ func (d *vmAffinityRuleDataSource) Configure(ctx context.Context, req datasource } func (d *vmAffinityRuleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vm_affinity_rule", d.client.GetOrgName(), metrics.Read)() + var data vmAffinityRuleDataSourceModel // Read Terraform configuration data into the model diff --git a/internal/provider/vm/vm_affinity_rule_resource.go b/internal/provider/vm/vm_affinity_rule_resource.go index 79ad521f9..0d43a9867 100644 --- a/internal/provider/vm/vm_affinity_rule_resource.go +++ b/internal/provider/vm/vm_affinity_rule_resource.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/uuid" @@ -80,6 +81,8 @@ func (r *vmAffinityRuleResource) Configure(ctx context.Context, req resource.Con // Create creates the resource and sets the initial Terraform state. func (r *vmAffinityRuleResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vm_affiny_rule", r.client.GetOrgName(), metrics.Create)() + // Retrieve values from plan var ( plan *vmAffinityRuleResourceModel @@ -120,6 +123,8 @@ func (r *vmAffinityRuleResource) Create(ctx context.Context, req resource.Create // Read refreshes the Terraform state with the latest data. func (r *vmAffinityRuleResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vm_affiny_rule", r.client.GetOrgName(), metrics.Read)() + var state *vmAffinityRuleResourceModel // Get current state @@ -168,6 +173,8 @@ func (r *vmAffinityRuleResource) Read(ctx context.Context, req resource.ReadRequ // Update updates the resource and sets the updated Terraform state on success. func (r *vmAffinityRuleResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + defer metrics.New("cloudavenue_vm_affiny_rule", r.client.GetOrgName(), metrics.Update)() + var plan *vmAffinityRuleResourceModel // Get current state @@ -226,6 +233,8 @@ func (r *vmAffinityRuleResource) Update(ctx context.Context, req resource.Update // Delete deletes the resource and removes the Terraform state on success. func (r *vmAffinityRuleResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vm_affiny_rule", r.client.GetOrgName(), metrics.Delete)() + var state *vmAffinityRuleResourceModel // Get current state @@ -253,6 +262,8 @@ func (r *vmAffinityRuleResource) Delete(ctx context.Context, req resource.Delete } func (r *vmAffinityRuleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vm_affiny_rule", r.client.GetOrgName(), metrics.Import)() + var state *vmAffinityRuleResourceModel resourceURI := strings.Split(req.ID, ".") diff --git a/internal/provider/vm/vm_datasource.go b/internal/provider/vm/vm_datasource.go index 162f96227..f62777af8 100644 --- a/internal/provider/vm/vm_datasource.go +++ b/internal/provider/vm/vm_datasource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminvdc" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -99,6 +100,8 @@ func (d *vmDataSource) Configure(ctx context.Context, req datasource.ConfigureRe } func (d *vmDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vm", d.client.GetOrgName(), metrics.Read)() + config := &VMDataSourceModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/vm/vm_disk_resource.go b/internal/provider/vm/vm_disk_resource.go index 5bbb74a89..45fdefed9 100644 --- a/internal/provider/vm/vm_disk_resource.go +++ b/internal/provider/vm/vm_disk_resource.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -163,6 +164,8 @@ func (r *diskResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe // Create creates the resource and sets the initial Terraform state. func (r *diskResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { //nolint:gocyclo + defer metrics.New("cloudavenue_vm_disk", r.client.GetOrgName(), metrics.Create)() + plan := &vm.Disk{} resp.Diagnostics.Append(req.Plan.Get(ctx, plan)...) @@ -365,6 +368,8 @@ func (r *diskResource) Create(ctx context.Context, req resource.CreateRequest, r // Read refreshes the Terraform state with the latest data. func (r *diskResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vm_disk", r.client.GetOrgName(), metrics.Read)() + state := &vm.Disk{} // Get current state @@ -445,6 +450,8 @@ func (r *diskResource) Read(ctx context.Context, req resource.ReadRequest, resp // Update updates the resource and sets the updated Terraform state on success. func (r *diskResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { //nolint:gocyclo + defer metrics.New("cloudavenue_vm_disk", r.client.GetOrgName(), metrics.Update)() + plan := &vm.Disk{} state := &vm.Disk{} @@ -654,6 +661,8 @@ func (r *diskResource) Update(ctx context.Context, req resource.UpdateRequest, r // Delete deletes the resource and removes the Terraform state on success. func (r *diskResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vm_disk", r.client.GetOrgName(), metrics.Delete)() + state := &vm.Disk{} // Get current state resp.Diagnostics.Append(req.State.Get(ctx, state)...) @@ -743,6 +752,8 @@ func (r *diskResource) Delete(ctx context.Context, req resource.DeleteRequest, r } func (r *diskResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vm_disk", r.client.GetOrgName(), metrics.Import)() + idParts := strings.Split(req.ID, ".") var ( diff --git a/internal/provider/vm/vm_disks_datasource.go b/internal/provider/vm/vm_disks_datasource.go index 8f10c5426..587141baf 100644 --- a/internal/provider/vm/vm_disks_datasource.go +++ b/internal/provider/vm/vm_disks_datasource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/org" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -87,6 +88,8 @@ func (d *disksDataSource) Configure(ctx context.Context, req datasource.Configur } func (d *disksDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_vm_disks", d.client.GetOrgName(), metrics.Read)() + config := &DisksModel{} // Read Terraform configuration data into the model diff --git a/internal/provider/vm/vm_resource.go b/internal/provider/vm/vm_resource.go index 6573e93de..e321d9826 100644 --- a/internal/provider/vm/vm_resource.go +++ b/internal/provider/vm/vm_resource.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/adminvdc" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vapp" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/common/vdc" @@ -110,6 +111,8 @@ func (r *vmResource) Configure(ctx context.Context, req resource.ConfigureReques // Create creates the resource and sets the initial Terraform state. func (r *vmResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + defer metrics.New("cloudavenue_vm", r.client.GetOrgName(), metrics.Create)() + plan := &vm.VMResourceModel{} var ( @@ -246,6 +249,8 @@ func (r *vmResource) Create(ctx context.Context, req resource.CreateRequest, res // Read refreshes the Terraform state with the latest data. func (r *vmResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + defer metrics.New("cloudavenue_vm", r.client.GetOrgName(), metrics.Read)() + state := &vm.VMResourceModel{} // Get current state @@ -288,6 +293,8 @@ func (r *vmResource) Read(ctx context.Context, req resource.ReadRequest, resp *r // Update updates the resource and sets the updated Terraform state on success. func (r *vmResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { //nolint:gocyclo + defer metrics.New("cloudavenue_vm", r.client.GetOrgName(), metrics.Update)() + plan := &vm.VMResourceModel{} state := &vm.VMResourceModel{} @@ -713,6 +720,8 @@ func (r *vmResource) Update(ctx context.Context, req resource.UpdateRequest, res // Delete deletes the resource and removes the Terraform state on success. func (r *vmResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + defer metrics.New("cloudavenue_vm", r.client.GetOrgName(), metrics.Delete)() + state := &vm.VMResourceModel{} // Get current state @@ -789,6 +798,8 @@ func (r *vmResource) Delete(ctx context.Context, req resource.DeleteRequest, res } func (r *vmResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + defer metrics.New("cloudavenue_vm", r.client.GetOrgName(), metrics.Import)() + idParts := strings.Split(req.ID, ".") if len(idParts) != 3 && len(idParts) != 2 { diff --git a/internal/provider/vrf/tier0_vrf_datasource.go b/internal/provider/vrf/tier0_vrf_datasource.go index 4c14a0489..8977f6b0e 100644 --- a/internal/provider/vrf/tier0_vrf_datasource.go +++ b/internal/provider/vrf/tier0_vrf_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" ) var ( @@ -55,6 +56,8 @@ func (d *tier0VrfDataSource) Configure(ctx context.Context, req datasource.Confi } func (d *tier0VrfDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_tier0_vrf", d.client.GetOrgName(), metrics.Read)() + var data tier0VrfDataSourceModel // Read Terraform configuration data into the model diff --git a/internal/provider/vrf/tier0_vrfs_datasource.go b/internal/provider/vrf/tier0_vrfs_datasource.go index 7c2d1e7bb..36be875d2 100644 --- a/internal/provider/vrf/tier0_vrfs_datasource.go +++ b/internal/provider/vrf/tier0_vrfs_datasource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/client" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/pkg/utils" ) @@ -56,6 +57,8 @@ func (d *tier0VrfsDataSource) Configure(ctx context.Context, req datasource.Conf } func (d *tier0VrfsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + defer metrics.New("data.cloudavenue_tier0_vrfs", d.client.GetOrgName(), metrics.Read)() + var data tier0VrfsDataSourceModel // Read Terraform configuration data into the model diff --git a/main.go b/main.go index c466dd796..caffad828 100644 --- a/main.go +++ b/main.go @@ -6,11 +6,15 @@ import ( "flag" "log" + "github.com/google/uuid" + "github.com/hashicorp/terraform-plugin-framework/providerserver" + "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/metrics" "github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider" _ "github.com/rs/zerolog" + _ "gopkg.in/yaml.v3" ) // Example version string that can be overwritten by a release process. @@ -30,6 +34,11 @@ func main() { ) flag.Parse() + // Generate a new execution ID for this run. + // Not error checking here because it's not critical. + x, _ := uuid.NewUUID() + metrics.GlobalExecutionID = x.String() + opts := providerserver.ServeOpts{ Address: "registry.terraform.io/orange-cloudavenue/cloudavenue", Debug: debug,