diff --git a/go.mod b/go.mod index 33fe270..309c492 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.adyxax.org/adyxax/terraform-provider-forgejo go 1.24.4 require ( - github.com/hashicorp/terraform-plugin-docs v0.21.0 + github.com/hashicorp/terraform-plugin-docs v0.22.0 github.com/hashicorp/terraform-plugin-framework v1.15.0 github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0 ) @@ -14,7 +14,7 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect - github.com/ProtonMail/go-crypto v1.1.3 // indirect + github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect @@ -33,9 +33,9 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.7.0 // indirect - github.com/hashicorp/hc-install v0.9.1 // indirect - github.com/hashicorp/terraform-exec v0.22.0 // indirect - github.com/hashicorp/terraform-json v0.24.0 // indirect + github.com/hashicorp/hc-install v0.9.2 // indirect + github.com/hashicorp/terraform-exec v0.23.0 // indirect + github.com/hashicorp/terraform-json v0.25.0 // indirect github.com/hashicorp/terraform-plugin-go v0.28.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.3.0 // indirect @@ -49,7 +49,7 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/oklog/run v1.1.0 // indirect + github.com/oklog/run v1.2.0 // indirect github.com/posener/complete v1.2.3 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/shopspring/decimal v1.3.1 // indirect @@ -59,7 +59,7 @@ require ( github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/yuin/goldmark v1.7.7 // indirect github.com/yuin/goldmark-meta v1.1.0 // indirect - github.com/zclconf/go-cty v1.16.2 // indirect + github.com/zclconf/go-cty v1.16.3 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect golang.org/x/crypto v0.39.0 // indirect golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect diff --git a/go.sum b/go.sum index 666ab3d..640482f 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,10 @@ github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7Y github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= 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.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk= -github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw= +github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= @@ -26,8 +26,8 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= -github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= -github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= +github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= 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= @@ -40,16 +40,16 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8= -github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM= -github.com/go-git/go-git/v5 v5.13.0 h1:vLn5wlGIh/X78El6r3Jr+30W16Blk0CTcxTYcYPWi5E= -github.com/go-git/go-git/v5 v5.13.0/go.mod h1:Wjo7/JyVKtQgUNdXYXIepzWfJQkUEIGvkvVkiXRR/zw= +github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= +github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= +github.com/go-git/go-git/v5 v5.14.0 h1:/MD3lCrGjCen5WfEAzKg00MJJffKhC8gzS80ycmCi60= +github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj9ItW3Wk5k= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -81,14 +81,14 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.9.1 h1:gkqTfE3vVbafGQo6VZXcy2v5yoz2bE0+nhZXruCuODQ= -github.com/hashicorp/hc-install v0.9.1/go.mod h1:pWWvN/IrfeBK4XPeXXYkL6EjMufHkCK5DvwxeLKuBf0= -github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8l+uRmZHj64= -github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= -github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= -github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= -github.com/hashicorp/terraform-plugin-docs v0.21.0 h1:yoyA/Y719z9WdFJAhpUkI1jRbKP/nteVNBaI3hW7iQ8= -github.com/hashicorp/terraform-plugin-docs v0.21.0/go.mod h1:J4Wott1J2XBKZPp/NkQv7LMShJYOcrqhQ2myXBcu64s= +github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+OmtO24= +github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I= +github.com/hashicorp/terraform-exec v0.23.0 h1:MUiBM1s0CNlRFsCLJuM5wXZrzA3MnPYEsiXmzATMW/I= +github.com/hashicorp/terraform-exec v0.23.0/go.mod h1:mA+qnx1R8eePycfwKkCRk3Wy65mwInvlpAeOwmA7vlY= +github.com/hashicorp/terraform-json v0.25.0 h1:rmNqc/CIfcWawGiwXmRuiXJKEiJu1ntGoxseG1hLhoQ= +github.com/hashicorp/terraform-json v0.25.0/go.mod h1:sMKS8fiRDX4rVlR6EJUMudg1WcanxCMoWwTLkgZP/vc= +github.com/hashicorp/terraform-plugin-docs v0.22.0 h1:fwIDStbFel1PPNkM+mDPnpB4efHZBdGoMz/zt5FbTDw= +github.com/hashicorp/terraform-plugin-docs v0.22.0/go.mod h1:55DJVyZ7BNK4t/lANcQ1YpemRuS6KsvIO1BbGA+xzGE= github.com/hashicorp/terraform-plugin-framework v1.15.0 h1:LQ2rsOfmDLxcn5EeIwdXFtr03FVsNktbbBci8cOKdb4= github.com/hashicorp/terraform-plugin-framework v1.15.0/go.mod h1:hxrNI/GY32KPISpWqlCoTLM9JZsGH3CyYlir09bD/fI= github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0 h1:v3DapR8gsp3EM8fKMh6up9cJUFQ2iRaFsYLP8UJnCco= @@ -139,10 +139,10 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp 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/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= +github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= @@ -150,15 +150,15 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= 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.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= -github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= +github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= +github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= 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= @@ -180,8 +180,8 @@ github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= -github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70= -github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk= +github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= @@ -214,8 +214,6 @@ golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= 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/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= -golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= diff --git a/internal/client/repositories.go b/internal/client/repositories.go index dc352f8..11eaa8b 100644 --- a/internal/client/repositories.go +++ b/internal/client/repositories.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/url" + "path" "strconv" "time" ) @@ -100,6 +101,94 @@ type Repository struct { WikiBranch string `json:"wiki_branch"` } +type RepositoryCreateRequest struct { + AutoInit bool `json:"auto_init,omitempty"` + DefaultBranch string `json:"default_branch,omitempty"` + DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"` + Description string `json:"description,omitempty"` + Gitignores string `json:"gitignores,omitempty"` + IssueLabels string `json:"issue_labels,omitempty"` + License string `json:"license,omitempty"` + Name string `json:"name,omitempty"` + ObjectFormatName string `json:"object_format_name,omitempty"` + Private bool `json:"private,omitempty"` + Readme string `json:"readme,omitempty"` + Template bool `json:"template,omitempty"` + TrustModel string `json:"trust_model,omitempty"` +} + +type RepositoryUpdateRequest struct { + AllowFastForwardOnlyMerge bool `json:"allow_fast_forward_only_merge,omitempty"` + AllowManualMerge bool `json:"allow_manual_merge,omitempty"` + AllowMergeCommits bool `json:"allow_merge_commits,omitempty"` + AllowRebase bool `json:"allow_rebase,omitempty"` + AllowRebaseExplicit bool `json:"allow_rebase_explicit,omitempty"` + AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"` + AllowSquashMerge bool `json:"allow_squash_merge,omitempty"` + Archived bool `json:"archived,omitempty"` + AutodetectManualMerge bool `json:"autodetect_manual_merge,omitempty"` + DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"` + DefaultBranch string `json:"default_branch,omitempty"` + DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"` + DefaultMergeStyle string `json:"default_merge_style,omitempty"` + DefaultUpdateStyle string `json:"default_update_style,omitempty"` + Description string `json:"description,omitempty"` + EnablePrune bool `json:"enable_prune,omitempty"` + ExternalTracker *RepositoryExternalTracker `json:"external_tracker,omitempty"` + ExternalWiki *RepositoryExternalWiki `json:"external_wiki,omitempty"` + GloballyEditableWiki bool `json:"globally_editable_wiki,omitempty"` + HasActions bool `json:"has_actions,omitempty"` + HasIssues bool `json:"has_issues,omitempty"` + HasPackages bool `json:"has_packages,omitempty"` + HasProjects bool `json:"has_projects,omitempty"` + HasPullRequests bool `json:"has_pull_requests,omitempty"` + HasReleases bool `json:"has_releases,omitempty"` + HasWiki bool `json:"has_wiki,omitempty"` + IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"` + InternalTracker *RepositoryInternalTracker `json:"internal_tracker,omitempty"` + MirrorInterval string `json:"mirror_interval,omitempty"` + Name string `json:"name,omitempty"` + Private bool `json:"private,omitempty"` + Template bool `json:"template,omitempty"` + Website string `json:"website,omitempty"` + WikiBranch string `json:"wiki_branch,omitempty"` +} + +func (c *Client) OrganizationRepositoryCreate(ctx context.Context, owner string, payload *RepositoryCreateRequest) (*Repository, error) { + uriRef := url.URL{Path: path.Join("api/v1/orgs", owner, "repos")} + response := Repository{} + if _, err := c.send(ctx, "POST", &uriRef, payload, &response); err != nil { + return nil, fmt.Errorf("failed to create organization repository: %w", err) + } + return &response, nil +} + +func (c *Client) UserRepositoryCreate(ctx context.Context, payload *RepositoryCreateRequest) (*Repository, error) { + uriRef := url.URL{Path: path.Join("api/v1/user/repos")} + response := Repository{} + if _, err := c.send(ctx, "POST", &uriRef, payload, &response); err != nil { + return nil, fmt.Errorf("failed to create user repository: %w", err) + } + return &response, nil +} + +func (c *Client) RepositoryGet(ctx context.Context, owner string, repo string) (*Repository, error) { + uriRef := url.URL{Path: path.Join("api/v1/repos", owner, repo)} + response := Repository{} + if _, err := c.send(ctx, "GET", &uriRef, nil, &response); err != nil { + return nil, fmt.Errorf("failed to get repository: %w", err) + } + return &response, nil +} + +func (c *Client) RepositoryDelete(ctx context.Context, owner string, repo string) error { + uriRef := url.URL{Path: path.Join("api/v1/repos", owner, repo)} + if _, err := c.send(ctx, "DELETE", &uriRef, nil, nil); err != nil { + return fmt.Errorf("failed to delete repository: %w", err) + } + return nil +} + func (c *Client) RepositoriesList(ctx context.Context) ([]Repository, error) { type Response struct { Data []Repository `json:"data"` @@ -128,3 +217,12 @@ func (c *Client) RepositoriesList(ctx context.Context) ([]Repository, error) { page++ } } + +func (c *Client) RepositoryUpdate(ctx context.Context, owner string, repo string, payload *RepositoryUpdateRequest) (*Repository, error) { + uriRef := url.URL{Path: path.Join("api/v1/repos", owner, repo)} + response := Repository{} + if _, err := c.send(ctx, "PATCH", &uriRef, payload, &response); err != nil { + return nil, fmt.Errorf("failed to update repository: %w", err) + } + return &response, nil +} diff --git a/internal/provider/user_repository_resource.go b/internal/provider/user_repository_resource.go new file mode 100644 index 0000000..bb66129 --- /dev/null +++ b/internal/provider/user_repository_resource.go @@ -0,0 +1,242 @@ +package provider + +import ( + "context" + "fmt" + + "git.adyxax.org/adyxax/terraform-provider-forgejo/internal/client" + "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +type UserRepositoryResource struct { + client *client.Client +} + +var _ resource.Resource = &UserRepositoryResource{} // Ensure provider defined types fully satisfy framework interfaces +func NewUserRepositoryResource() resource.Resource { + return &UserRepositoryResource{} +} + +type UserRepositoryResourceModel struct { + AllowFastForwardOnlyMerge types.Bool `tfsdk:"allow_fast_forward_only_merge"` + AllowManualMerge types.Bool `tfsdk:"allow_manual_merge"` + AllowMergeCommits types.Bool `tfsdk:"allow_merge_commits"` + AllowRebase types.Bool `tfsdk:"allow_rebase"` + AllowRebaseExplicit types.Bool `tfsdk:"allow_rebase_explicit"` + AllowRebaseUpdate types.Bool `tfsdk:"allow_rebase_update"` + AllowSquashMerge types.Bool `tfsdk:"allow_squash_merge"` + ArchivedAt timetypes.RFC3339 `tfsdk:"archived_at"` + Archived types.Bool `tfsdk:"archived"` + AutodetectManualMerge types.Bool `tfsdk:"autodetect_manual_merge"` + AutoInit types.Bool `tfsdk:"auto_init"` + AvatarUrl types.String `tfsdk:"avatar_url"` + CloneUrl types.String `tfsdk:"clone_url"` + CreatedAt timetypes.RFC3339 `tfsdk:"created_at"` + DefaultAllowMaintainerEdit types.Bool `tfsdk:"default_allow_maintainer_edit"` + DefaultBranch types.String `tfsdk:"default_branch"` + DefaultDeleteBranchAfterMerge types.Bool `tfsdk:"default_delete_branch_after_merge"` + DefaultMergeStyle types.String `tfsdk:"default_merge_style"` + DefaultUpdateStyle types.String `tfsdk:"default_update_style"` + Description types.String `tfsdk:"description"` + Empty types.Bool `tfsdk:"empty"` + EnablePrune types.Bool `tfsdk:"enable_prune"` + ExternalTracker *RepositoryExternalTrackerDataSourceModel `tfsdk:"external_tracker"` + ExternalWiki *RepositoryExternalWikiDataSourceModel `tfsdk:"external_wiki"` + Fork types.Bool `tfsdk:"fork"` + ForksCount types.Int64 `tfsdk:"forks_count"` + FullName types.String `tfsdk:"full_name"` + Gitignores types.String `tfsdk:"gitignores"` + GloballyEditableWiki types.Bool `tfsdk:"globally_editable_wiki"` + HasActions types.Bool `tfsdk:"has_actions"` + HasIssues types.Bool `tfsdk:"has_issues"` + HasPackages types.Bool `tfsdk:"has_packages"` + HasProjects types.Bool `tfsdk:"has_projects"` + HasPullRequests types.Bool `tfsdk:"has_pull_requests"` + HasReleases types.Bool `tfsdk:"has_releases"` + HasWiki types.Bool `tfsdk:"has_wiki"` + HtmlUrl types.String `tfsdk:"html_url"` + Id types.Int64 `tfsdk:"id"` + IgnoreWhitespaceConflicts types.Bool `tfsdk:"ignore_whitespace_conflicts"` + Internal types.Bool `tfsdk:"internal"` + InternalTracker *RepositoryInternalTrackerDataSourceModel `tfsdk:"internal_tracker"` + IssueLabels types.String `tfsdk:"issue_labels"` + Language types.String `tfsdk:"language"` + LanguagesUrl types.String `tfsdk:"languages_url"` + License types.String `tfsdk:"license"` + Link types.String `tfsdk:"link"` + Mirror types.Bool `tfsdk:"mirror"` + MirrorInterval types.String `tfsdk:"mirror_interval"` + MirrorUpdated timetypes.RFC3339 `tfsdk:"mirror_updated"` + Name types.String `tfsdk:"name"` + ObjectFormatName types.String `tfsdk:"object_format_name"` + OpenIssuesCount types.Int64 `tfsdk:"open_issues_count"` + OpenPrCounter types.Int64 `tfsdk:"open_pr_counter"` + OriginalUrl types.String `tfsdk:"original_url"` + Owner *UserDataSourceModel `tfsdk:"owner"` + //terraform does not support recursive schema definitions + //Parent *UserRepositoryDataSourceModel `tfsdk:"parent"` + Permissions *PermissionDataSourceModel `tfsdk:"permissions"` + Private types.Bool `tfsdk:"private"` + Readme types.String `tfsdk:"readme"` + ReleaseCounter types.Int64 `tfsdk:"release_counter"` + RepoTransfer *RepositoryTransferDataSourceModel `tfsdk:"repo_transfer"` + Size types.Int64 `tfsdk:"size"` + SshUrl types.String `tfsdk:"ssh_url"` + StarsCount types.Int64 `tfsdk:"stars_count"` + Template types.Bool `tfsdk:"template"` + Topics []types.String `tfsdk:"topics"` + TrustModel types.String `tfsdk:"trust_model"` + UpdatedAt timetypes.RFC3339 `tfsdk:"updated_at"` + Url types.String `tfsdk:"url"` + WatchersCount types.Int64 `tfsdk:"watchers_count"` + Website types.String `tfsdk:"website"` + WikiBranch types.String `tfsdk:"wiki_branch"` +} + +func (d *UserRepositoryResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_user_repository" +} + +func (d *UserRepositoryResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "allow_fast_forward_only_merge": schema.BoolAttribute{ + Computed: true, + Default: booldefault.StaticBool(true), + MarkdownDescription: "Whether fast forward only merges are allowed or not. Defaults to true.", + Optional: true, + }, + "allow_manual_merge": schema.BoolAttribute{ + Computed: true, + Default: booldefault.StaticBool(true), + MarkdownDescription: "Whether manual merges are allowed or not. Defaults to true.", + Optional: true, + }, + "allow_merge_commits": schema.BoolAttribute{ + Computed: true, + Default: booldefault.StaticBool(true), + MarkdownDescription: "Whether merge commits are allowed or not. Defaults to true.", + Optional: true, + }, + "allow_rebase": schema.BoolAttribute{ + Computed: true, + Default: booldefault.StaticBool(true), + MarkdownDescription: "Whether rebases are allowed or not. Defaults to true.", + Optional: true, + }, + "allow_rebase_explicit": schema.BoolAttribute{ + Computed: true, + Default: booldefault.StaticBool(true), + MarkdownDescription: "Whether explicit rebases are allowed or not. Defaults to true.", + Optional: true, + }, + }, + MarkdownDescription: "Use this resource to create and manage a repository belonging to the user whose credentials you are instantiating the provider with.", + } +} + +func (d *UserRepositoryResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + d.client, _ = req.ProviderData.(*client.Client) +} + +func (d *UserRepositoryResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var data UserRepositoryResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + request := client.UserRepositoryCreateRequest{ + Color: data.Color.ValueString(), + Description: data.Description.ValueString(), + Exclusive: data.Exclusive.ValueBool(), + IsArchived: data.IsArchived.ValueBool(), + Name: data.Name.ValueString(), + } + label, err := d.client.UserRepositoryCreate( + ctx, + data.Owner.ValueString(), + data.UserRepository.ValueString(), + &request) + if err != nil { + resp.Diagnostics.AddError("CreateUserRepository", fmt.Sprintf("failed to create UserRepository: %s", err)) + return + } + data.Id = types.Int64Value(label.Id) + data.Url = types.StringValue(label.Url) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (d *UserRepositoryResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var data UserRepositoryResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + err := d.client.UserRepositoryDelete( + ctx, + data.Owner.ValueString(), + data.UserRepository.ValueString(), + data.Id.ValueInt64()) + if err != nil { + resp.Diagnostics.AddError("DeleteUserRepository", fmt.Sprintf("failed to delete UserRepository: %s", err)) + return + } +} + +func (d *UserRepositoryResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var data UserRepositoryResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + label, err := d.client.UserRepositoryGet( + ctx, + data.Owner.ValueString(), + data.UserRepository.ValueString(), + data.Id.ValueInt64()) + if err != nil { + resp.Diagnostics.AddError("ReadUserRepository", fmt.Sprintf("failed to get UserRepository: %s", err)) + return + } + data.Color = types.StringValue(label.Color) + data.Description = types.StringValue(label.Description) + data.Exclusive = types.BoolValue(label.Exclusive) + data.IsArchived = types.BoolValue(label.IsArchived) + data.Name = types.StringValue(label.Name) + data.Url = types.StringValue(label.Url) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (d *UserRepositoryResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plannedData UserRepositoryResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &plannedData)...) + var stateData UserRepositoryResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + if resp.Diagnostics.HasError() { + return + } + request := client.UserRepositoryUpdateRequest{ + Color: plannedData.Color.ValueString(), + Description: plannedData.Description.ValueString(), + Exclusive: plannedData.Exclusive.ValueBool(), + IsArchived: plannedData.IsArchived.ValueBool(), + Name: plannedData.Name.ValueString(), + } + label, err := d.client.UserRepositoryUpdate( + ctx, + plannedData.Owner.ValueString(), + plannedData.UserRepository.ValueString(), + stateData.Id.ValueInt64(), + &request) + if err != nil { + resp.Diagnostics.AddError("UpdateUserRepository", fmt.Sprintf("failed to update UserRepository: %s", err)) + return + } + plannedData.Id = types.Int64Value(label.Id) + plannedData.Url = types.StringValue(label.Url) + resp.Diagnostics.Append(resp.State.Set(ctx, &plannedData)...) +}