diff --git a/README.md b/README.md index 7491e1dbe..e2ce41ad7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Actions Status](https://github.com/atlassian/terraform-provider-artifactory/workflows/build/badge.svg)](https://github.com/atlassian/terraform-provider-artifactory/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/atlassian/terraform-provider-artifactory)](https://goreportcard.com/report/github.com/atlassian/terraform-provider-artifactory) +To use this provider in your Terraform module, follow the documentation [here](website/docs/index.html.markdown). + ## Build the Provider If you're building the provider, follow the instructions to [install it as a plugin](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin). After placing it into your plugins directory, run `terraform init` to initialize it. diff --git a/go.mod b/go.mod index 0761b3d14..8b52bb370 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/atlassian/terraform-provider-artifactory require ( github.com/atlassian/go-artifactory/v2 v2.5.0 github.com/hashicorp/terraform v0.12.29 + github.com/jfrog/jfrog-client-go v0.13.1 github.com/stretchr/testify v1.5.1 ) diff --git a/go.sum b/go.sum index 4dcdf661a..93dd32ae9 100644 --- a/go.sum +++ b/go.sum @@ -38,11 +38,13 @@ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= +github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible/go.mod h1:LDQHRZylxvcg8H7wBIDfvO5g/cy4/sz1iucBlc2l3Jw= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= @@ -76,6 +78,7 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk= github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/buger/jsonparser v0.0.0-20180910192245-6acdf747ae99/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -96,14 +99,22 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= +github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= +github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y= +github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= +github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -131,6 +142,8 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= @@ -219,6 +232,12 @@ github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +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/jfrog/gofrog v1.0.6 h1:yUDxSCw8gTK6vC4PvtG0HTnEOQJSZ+O4lWGCgkev1nU= +github.com/jfrog/gofrog v1.0.6/go.mod h1:HkDzg+tMNw23UryoOv0+LB94BzYcl6MCIoz8Tmlb+s8= +github.com/jfrog/jfrog-client-go v0.13.1 h1:kY0VS+IkG/chQNiPXGbUGZUOVzbr5O0DgPy7cZK5+DQ= +github.com/jfrog/jfrog-client-go v0.13.1/go.mod h1:Av1I4oFHu+frbD+xqZV4fdAp3Kpt43uFfBnV6Hag+t8= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -236,7 +255,11 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8= +github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -274,6 +297,8 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-shellwords v1.0.4 h1:xmZZyxuP+bYKAKkA9ABYXVNJ+G/Wf3R8d8vAP3LDJJk= github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mholt/archiver v2.1.0+incompatible h1:1ivm7KAHPtPere1YDOdrY6xGdbMNGRWThZbYh5lWZT0= +github.com/mholt/archiver v2.1.0+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -309,13 +334,20 @@ github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISe github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs= +github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y= github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA= +github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= +github.com/pierrec/lz4 v2.3.0+incompatible h1:CZzRn4Ut9GbUkHlQ7jqBXeZQV41ZSKWFc302ZU6lUTk= +github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/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= @@ -344,6 +376,8 @@ github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/src-d/gcfg v1.3.0 h1:2BEDr8r0I0b8h/fOqwtxCEiq2HJu8n2JGZJQFGXWLjg= +github.com/src-d/gcfg v1.3.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -362,9 +396,12 @@ github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5 h1:cMjKdf4PxEBN9K5HaD9UM github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8= +github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU= github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8= github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= @@ -384,6 +421,7 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= @@ -406,6 +444,7 @@ golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -433,7 +472,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -502,6 +543,13 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= +gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= +gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= +gopkg.in/src-d/go-git.v4 v4.7.0 h1:WXB+2gCoRhQiAr//IMHpIpoDsTrDgvjDORxt57e8XTA= +gopkg.in/src-d/go-git.v4 v4.7.0/go.mod h1:CzbUWqMn4pvmvndg3gnh5iZFmSsbhyhUWdI0IQ60AQo= +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.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/pkg/artifactory/datasource_artifactory_file.go b/pkg/artifactory/datasource_artifactory_file.go index 473f3cea9..62ae82d4a 100644 --- a/pkg/artifactory/datasource_artifactory_file.go +++ b/pkg/artifactory/datasource_artifactory_file.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "encoding/hex" "fmt" - "github.com/atlassian/go-artifactory/v2/artifactory" "github.com/hashicorp/terraform/helper/schema" "io" "os" @@ -82,7 +81,7 @@ func dataSourceArtifactoryFile() *schema.Resource { } func dataSourceFileRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repository := d.Get("repository").(string) path := d.Get("path").(string) diff --git a/pkg/artifactory/datasource_artifactory_fileinfo.go b/pkg/artifactory/datasource_artifactory_fileinfo.go index d1bbb5c97..9d47b046f 100644 --- a/pkg/artifactory/datasource_artifactory_fileinfo.go +++ b/pkg/artifactory/datasource_artifactory_fileinfo.go @@ -3,7 +3,6 @@ package artifactory import ( "context" "fmt" - "github.com/atlassian/go-artifactory/v2/artifactory" "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/schema" ) @@ -70,7 +69,7 @@ func dataSourceArtifactoryFileInfo() *schema.Resource { } func dataSourceFileInfoRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repository := d.Get("repository").(string) path := d.Get("path").(string) diff --git a/pkg/artifactory/provider.go b/pkg/artifactory/provider.go index e591ebac8..d58235b7f 100644 --- a/pkg/artifactory/provider.go +++ b/pkg/artifactory/provider.go @@ -5,12 +5,25 @@ import ( "fmt" "net/http" - "github.com/atlassian/go-artifactory/v2/artifactory" + artifactoryold "github.com/atlassian/go-artifactory/v2/artifactory" "github.com/atlassian/go-artifactory/v2/artifactory/transport" + artifactorynew "github.com/jfrog/jfrog-client-go/artifactory" + "github.com/jfrog/jfrog-client-go/artifactory/usage" + "github.com/jfrog/jfrog-client-go/artifactory/auth" + "github.com/jfrog/jfrog-client-go/utils/log" + "github.com/jfrog/jfrog-client-go/config" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform/version" ) +var ProviderVersion = "2.1.0" + +type ArtClient struct { + ArtOld *artifactoryold.Artifactory + ArtNew *artifactorynew.ArtifactoryServicesManager +} + // Artifactory Provider that supports configuration via username+password or a token // Supported resources are repos, users, groups, replications, and permissions func Provider() terraform.ResourceProvider { @@ -34,14 +47,6 @@ func Provider() terraform.ResourceProvider { DefaultFunc: schema.EnvDefaultFunc("ARTIFACTORY_PASSWORD", nil), ConflictsWith: []string{"access_token", "api_key"}, }, - "token": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - DefaultFunc: schema.EnvDefaultFunc("ARTIFACTORY_TOKEN", nil), - ConflictsWith: []string{"api_key"}, - Deprecated: "Since v1.5. Renamed to api_key", - }, "api_key": { Type: schema.TypeString, Optional: true, @@ -93,43 +98,75 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { apiKey := d.Get("api_key").(string) accessToken := d.Get("access_token").(string) - // Deprecated - token := d.Get("token").(string) + log.SetLogger(log.NewLogger(log.INFO, nil)) var client *http.Client + details := auth.NewArtifactoryDetails() + + url := d.Get("url").(string) + if url[len(url)-1] != '/' { + url += "/" + } + details.SetUrl(url) + if username != "" && password != "" { + details.SetUser(username) + details.SetPassword(password) tp := transport.BasicAuth{ Username: username, Password: password, } client = tp.Client() } else if apiKey != "" { + details.SetApiKey(apiKey) tp := &transport.ApiKeyAuth{ ApiKey: apiKey, } client = tp.Client() } else if accessToken != "" { + details.SetAccessToken(accessToken) tp := &transport.AccessTokenAuth{ AccessToken: accessToken, } client = tp.Client() - } else if token != "" { - tp := &transport.ApiKeyAuth{ - ApiKey: token, - } - client = tp.Client() } else { return nil, fmt.Errorf("either [username, password] or [api_key] or [access_token] must be set to use provider") } - rt, err := artifactory.NewClient(d.Get("url").(string), client) + config, err := config.NewConfigBuilder(). + SetServiceDetails(details). + SetDryRun(false). + Build() if err != nil { return nil, err - } else if _, resp, err := rt.V1.System.Ping(context.Background()); err != nil { + } + + rtold, err := artifactoryold.NewClient(d.Get("url").(string), client) + + if err != nil { + return nil, err + } + + rtnew, err := artifactorynew.New(&details, config) + + if err != nil { + return nil, err + } else if _, resp, err := rtold.V1.System.Ping(context.Background()); err != nil { return nil, err } else if resp.StatusCode != 200 { return nil, fmt.Errorf("failed to ping server. Got %d", resp.StatusCode) + } else if _, err := rtnew.Ping(); err != nil { + return nil, err + } + + productid := "terraform-provider-artifactory/" + ProviderVersion + commandid := "Terraform/" + version.Version + usage.SendReportUsage(productid, commandid, rtnew) + + rt := &ArtClient{ + ArtOld: rtold, + ArtNew: rtnew, } return rt, nil diff --git a/pkg/artifactory/resource_artifactory_api_key.go b/pkg/artifactory/resource_artifactory_api_key.go index 3615db0af..7254ede5f 100644 --- a/pkg/artifactory/resource_artifactory_api_key.go +++ b/pkg/artifactory/resource_artifactory_api_key.go @@ -6,7 +6,6 @@ import ( "net/http" "strconv" - "github.com/atlassian/go-artifactory/v2/artifactory" v1 "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" @@ -54,7 +53,7 @@ func packApiKey(apiKey *v1.ApiKey, d *schema.ResourceData) error { } func resourceApiKeyCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld apiKey, _, err := c.V1.Security.CreateApiKey(context.Background()) if err != nil { @@ -66,7 +65,7 @@ func resourceApiKeyCreate(d *schema.ResourceData, m interface{}) error { } func resourceApiKeyRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld apiKey, resp, err := c.V1.Security.GetApiKey(context.Background()) if resp.StatusCode == http.StatusNotFound { @@ -80,7 +79,7 @@ func resourceApiKeyRead(d *schema.ResourceData, m interface{}) error { } func resourceApiKeyDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, resp, err := c.V1.Security.RevokeApiKey(context.Background()) if resp.StatusCode == http.StatusNotFound { return nil diff --git a/pkg/artifactory/resource_artifactory_certificate.go b/pkg/artifactory/resource_artifactory_certificate.go index 326ffcac0..9a4b66fb3 100644 --- a/pkg/artifactory/resource_artifactory_certificate.go +++ b/pkg/artifactory/resource_artifactory_certificate.go @@ -9,7 +9,6 @@ import ( "fmt" "strings" - "github.com/atlassian/go-artifactory/v2/artifactory" v1 "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/schema" ) @@ -116,7 +115,7 @@ func calculateFingerPrint(pemData string) (string, error) { } func findCertificate(d *schema.ResourceData, m interface{}) (*v1.CertificateDetails, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld certs, _, err := c.V1.Security.GetCertificates(context.Background()) if err != nil { @@ -168,7 +167,7 @@ func resourceCertificateRead(d *schema.ResourceData, m interface{}) error { } func resourceCertificateUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, _, err := c.V1.Security.AddCertificate(context.Background(), d.Id(), strings.NewReader(d.Get("content").(string))) if err != nil { @@ -179,7 +178,7 @@ func resourceCertificateUpdate(d *schema.ResourceData, m interface{}) error { } func resourceCertificateDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, _, err := c.V1.Security.DeleteCertificate(context.Background(), d.Id()) if err != nil { diff --git a/pkg/artifactory/resource_artifactory_group.go b/pkg/artifactory/resource_artifactory_group.go index e272a5629..0e7692ac4 100644 --- a/pkg/artifactory/resource_artifactory_group.go +++ b/pkg/artifactory/resource_artifactory_group.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/terraform/helper/resource" "net/http" - "github.com/atlassian/go-artifactory/v2/artifactory" "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/schema" ) @@ -78,7 +77,7 @@ func unmarshalGroup(s *schema.ResourceData) (*v1.Group, error) { } func resourceGroupCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld group, err := unmarshalGroup(d) @@ -94,7 +93,7 @@ func resourceGroupCreate(d *schema.ResourceData, m interface{}) error { d.SetId(*group.Name) return resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, resp, err := c.V1.Security.GetGroup(context.Background(), d.Id()) if err != nil { return resource.NonRetryableError(fmt.Errorf("error describing group: %s", err)) @@ -109,7 +108,7 @@ func resourceGroupCreate(d *schema.ResourceData, m interface{}) error { } func resourceGroupRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld group, resp, err := c.V1.Security.GetGroup(context.Background(), d.Id()) @@ -137,7 +136,7 @@ func resourceGroupRead(d *schema.ResourceData, m interface{}) error { } func resourceGroupUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld group, err := unmarshalGroup(d) if err != nil { return err @@ -152,7 +151,7 @@ func resourceGroupUpdate(d *schema.ResourceData, m interface{}) error { } func resourceGroupDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld group, err := unmarshalGroup(d) if err != nil { return err @@ -168,7 +167,7 @@ func resourceGroupDelete(d *schema.ResourceData, m interface{}) error { } func resourceGroupExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld groupName := d.Id() _, resp, err := c.V1.Security.GetGroup(context.Background(), groupName) diff --git a/pkg/artifactory/resource_artifactory_local_repository.go b/pkg/artifactory/resource_artifactory_local_repository.go index 17aca555e..985f01cb3 100644 --- a/pkg/artifactory/resource_artifactory_local_repository.go +++ b/pkg/artifactory/resource_artifactory_local_repository.go @@ -178,7 +178,7 @@ func unmarshalLocalRepository(s *schema.ResourceData) *v1.LocalRepository { } func resourceLocalRepositoryCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unmarshalLocalRepository(d) @@ -192,7 +192,7 @@ func resourceLocalRepositoryCreate(d *schema.ResourceData, m interface{}) error } func resourceLocalRepositoryRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo, resp, err := c.V1.Repositories.GetLocal(context.Background(), d.Id()) @@ -236,7 +236,7 @@ func resourceLocalRepositoryRead(d *schema.ResourceData, m interface{}) error { } func resourceLocalRepositoryUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unmarshalLocalRepository(d) _, err := c.V1.Repositories.UpdateLocal(context.Background(), d.Id(), repo) @@ -250,7 +250,7 @@ func resourceLocalRepositoryUpdate(d *schema.ResourceData, m interface{}) error } func resourceLocalRepositoryDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unmarshalLocalRepository(d) resp, err := c.V1.Repositories.DeleteLocal(context.Background(), *repo.Key) @@ -263,7 +263,7 @@ func resourceLocalRepositoryDelete(d *schema.ResourceData, m interface{}) error } func resourceLocalRepositoryExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, resp, err := c.V1.Repositories.GetLocal(context.Background(), d.Id()) diff --git a/pkg/artifactory/resource_artifactory_permission_target.go b/pkg/artifactory/resource_artifactory_permission_target.go index 9b523089e..8287f146a 100644 --- a/pkg/artifactory/resource_artifactory_permission_target.go +++ b/pkg/artifactory/resource_artifactory_permission_target.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/terraform/helper/resource" "net/http" - "github.com/atlassian/go-artifactory/v2/artifactory" v2 "github.com/atlassian/go-artifactory/v2/artifactory/v2" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -313,7 +312,7 @@ func packPermissionTarget(permissionTarget *v2.PermissionTarget, d *schema.Resou } func resourcePermissionTargetCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld if _, ok := d.GetOk("repositories"); ok { return resourcePermissionTargetV1CreateOrReplace(d, m) @@ -328,7 +327,7 @@ func resourcePermissionTargetCreate(d *schema.ResourceData, m interface{}) error d.SetId(*permissionTarget.Name) return resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld exists, err := c.V2.Security.HasPermissionTarget(context.Background(), d.Id()) if err != nil { return resource.NonRetryableError(fmt.Errorf("error describing permssions target: %s", err)) @@ -343,7 +342,7 @@ func resourcePermissionTargetCreate(d *schema.ResourceData, m interface{}) error } func resourcePermissionTargetRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld if _, ok := d.GetOk("repositories"); ok { return resourcePermissionTargetV1Read(d, m) @@ -361,7 +360,7 @@ func resourcePermissionTargetRead(d *schema.ResourceData, m interface{}) error { } func resourcePermissionTargetUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld if _, ok := d.GetOk("repositories"); ok { return resourcePermissionTargetV1CreateOrReplace(d, m) @@ -377,7 +376,7 @@ func resourcePermissionTargetUpdate(d *schema.ResourceData, m interface{}) error } func resourcePermissionTargetDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld if _, ok := d.GetOk("repositories"); ok { return resourcePermissionTargetV1Delete(d, m) @@ -393,7 +392,7 @@ func resourcePermissionTargetDelete(d *schema.ResourceData, m interface{}) error } func resourcePermissionTargetExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld if _, ok := d.GetOk("repositories"); ok { _, resp, err := c.V1.Security.GetPermissionTargets(context.Background(), d.Id()) diff --git a/pkg/artifactory/resource_artifactory_permission_targets_v1.go b/pkg/artifactory/resource_artifactory_permission_targets_v1.go index 456a9fabd..e19d3b57d 100644 --- a/pkg/artifactory/resource_artifactory_permission_targets_v1.go +++ b/pkg/artifactory/resource_artifactory_permission_targets_v1.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" - "github.com/atlassian/go-artifactory/v2/artifactory" v1 "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" @@ -98,7 +97,7 @@ func hashPrincipal(o interface{}) int { } func resourcePermissionTargetV1CreateOrReplace(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld permissionTarget := unpackPermissionTargetV1(d) _, err := c.V1.Security.CreateOrReplacePermissionTargets(context.Background(), *permissionTarget.Name, permissionTarget) @@ -111,7 +110,7 @@ func resourcePermissionTargetV1CreateOrReplace(d *schema.ResourceData, m interfa } func resourcePermissionTargetV1Read(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld permissionTarget, resp, err := c.V1.Security.GetPermissionTargets(context.Background(), d.Id()) if resp.StatusCode == http.StatusNotFound { @@ -125,7 +124,7 @@ func resourcePermissionTargetV1Read(d *schema.ResourceData, m interface{}) error } func resourcePermissionTargetV1Delete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld permissionTarget := unpackPermissionTargetV1(d) _, resp, err := c.V1.Security.DeletePermissionTargets(context.Background(), *permissionTarget.Name) diff --git a/pkg/artifactory/resource_artifactory_remote_repository.go b/pkg/artifactory/resource_artifactory_remote_repository.go index ea7e52d7c..3cfa3ea35 100644 --- a/pkg/artifactory/resource_artifactory_remote_repository.go +++ b/pkg/artifactory/resource_artifactory_remote_repository.go @@ -451,7 +451,7 @@ func packRemoteRepo(repo *v1.RemoteRepository, d *schema.ResourceData) error { } func resourceRemoteRepositoryCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackRemoteRepo(d) _, err := c.V1.Repositories.CreateRemote(context.Background(), repo) @@ -464,7 +464,7 @@ func resourceRemoteRepositoryCreate(d *schema.ResourceData, m interface{}) error } func resourceRemoteRepositoryRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo, resp, err := c.V1.Repositories.GetRemote(context.Background(), d.Id()) if resp.StatusCode == http.StatusNotFound { @@ -478,7 +478,7 @@ func resourceRemoteRepositoryRead(d *schema.ResourceData, m interface{}) error { } func resourceRemoteRepositoryUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackRemoteRepo(d) @@ -492,7 +492,7 @@ func resourceRemoteRepositoryUpdate(d *schema.ResourceData, m interface{}) error } func resourceRemoteRepositoryDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackRemoteRepo(d) resp, err := c.V1.Repositories.DeleteRemote(context.Background(), *repo.Key) @@ -505,7 +505,7 @@ func resourceRemoteRepositoryDelete(d *schema.ResourceData, m interface{}) error } func resourceRemoteRepositoryExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld key := d.Id() _, resp, err := c.V1.Repositories.GetRemote(context.Background(), key) diff --git a/pkg/artifactory/resource_artifactory_replication_config.go b/pkg/artifactory/resource_artifactory_replication_config.go index 1f3206202..c017eaa68 100644 --- a/pkg/artifactory/resource_artifactory_replication_config.go +++ b/pkg/artifactory/resource_artifactory_replication_config.go @@ -223,7 +223,7 @@ func packReplicationConfig(replicationConfig *v1.ReplicationConfig, d *schema.Re } func resourceReplicationConfigCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackReplicationConfig(d) @@ -237,7 +237,7 @@ func resourceReplicationConfigCreate(d *schema.ResourceData, m interface{}) erro } func resourceReplicationConfigRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig, _, err := c.V1.Artifacts.GetRepositoryReplicationConfig(context.Background(), d.Id()) @@ -249,7 +249,7 @@ func resourceReplicationConfigRead(d *schema.ResourceData, m interface{}) error } func resourceReplicationConfigUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackReplicationConfig(d) _, err := c.V1.Artifacts.UpdateRepositoryReplicationConfig(context.Background(), d.Id(), replicationConfig) @@ -263,14 +263,14 @@ func resourceReplicationConfigUpdate(d *schema.ResourceData, m interface{}) erro } func resourceReplicationConfigDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackReplicationConfig(d) _, err := c.V1.Artifacts.DeleteRepositoryReplicationConfig(context.Background(), *replicationConfig.RepoKey) return err } func resourceReplicationConfigExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationName := d.Id() _, resp, err := c.V1.Artifacts.GetRepositoryReplicationConfig(context.Background(), replicationName) diff --git a/pkg/artifactory/resource_artifactory_single_replication_config.go b/pkg/artifactory/resource_artifactory_single_replication_config.go index 3d16ea94b..0e7e6cd7f 100644 --- a/pkg/artifactory/resource_artifactory_single_replication_config.go +++ b/pkg/artifactory/resource_artifactory_single_replication_config.go @@ -3,7 +3,6 @@ package artifactory import ( "context" "fmt" - "github.com/atlassian/go-artifactory/v2/artifactory" "github.com/atlassian/go-artifactory/v2/artifactory/v1" "github.com/hashicorp/terraform/helper/schema" "net/http" @@ -157,7 +156,7 @@ func packSingleReplicationConfig(replicationConfig *v1.ReplicationConfig, d *sch } func resourceSingleReplicationConfigCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackSingleReplicationConfig(d) @@ -171,7 +170,7 @@ func resourceSingleReplicationConfigCreate(d *schema.ResourceData, m interface{} } func resourceSingleReplicationConfigRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig, _, err := c.V1.Artifacts.GetRepositoryReplicationConfig(context.Background(), d.Id()) @@ -185,7 +184,7 @@ func resourceSingleReplicationConfigRead(d *schema.ResourceData, m interface{}) } func resourceSingleReplicationConfigUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackSingleReplicationConfig(d) _, err := c.V1.Artifacts.UpdateSingleRepositoryReplicationConfig(context.Background(), d.Id(), replicationConfig) @@ -199,14 +198,14 @@ func resourceSingleReplicationConfigUpdate(d *schema.ResourceData, m interface{} } func resourceSingleReplicationConfigDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationConfig := unpackSingleReplicationConfig(d) _, err := c.V1.Artifacts.DeleteRepositoryReplicationConfig(context.Background(), *replicationConfig.RepoKey) return err } func resourceSingleReplicationConfigExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld replicationName := d.Id() replicationConfig, resp, err := c.V1.Artifacts.GetRepositoryReplicationConfig(context.Background(), replicationName) diff --git a/pkg/artifactory/resource_artifactory_user.go b/pkg/artifactory/resource_artifactory_user.go index 2951dfc03..63fea44fb 100644 --- a/pkg/artifactory/resource_artifactory_user.go +++ b/pkg/artifactory/resource_artifactory_user.go @@ -121,7 +121,7 @@ func packUser(user *v1.User, d *schema.ResourceData) error { } func resourceUserCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld user := unpackUser(d) @@ -140,7 +140,7 @@ func resourceUserCreate(d *schema.ResourceData, m interface{}) error { d.SetId(*user.Name) return resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld _, resp, err := c.V1.Security.GetUser(context.Background(), d.Id()) if err != nil { return resource.NonRetryableError(fmt.Errorf("error describing user: %s", err)) @@ -155,7 +155,7 @@ func resourceUserCreate(d *schema.ResourceData, m interface{}) error { } func resourceUserRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld user, resp, err := c.V1.Security.GetUser(context.Background(), d.Id()) if resp.StatusCode == http.StatusNotFound { @@ -169,7 +169,7 @@ func resourceUserRead(d *schema.ResourceData, m interface{}) error { } func resourceUserUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld user := unpackUser(d) if user.Password != nil && len(*user.Password) == 0 { @@ -186,7 +186,7 @@ func resourceUserUpdate(d *schema.ResourceData, m interface{}) error { } func resourceUserDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld user := unpackUser(d) _, resp, err := c.V1.Security.DeleteUser(context.Background(), *user.Name) if resp.StatusCode == http.StatusNotFound { diff --git a/pkg/artifactory/resource_artifactory_virtual_repository.go b/pkg/artifactory/resource_artifactory_virtual_repository.go index f64e5889e..095fb08e1 100644 --- a/pkg/artifactory/resource_artifactory_virtual_repository.go +++ b/pkg/artifactory/resource_artifactory_virtual_repository.go @@ -132,7 +132,7 @@ func packVirtualRepository(repo *v1.VirtualRepository, d *schema.ResourceData) e } func resourceVirtualRepositoryCreate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackVirtualRepository(d) @@ -146,7 +146,7 @@ func resourceVirtualRepositoryCreate(d *schema.ResourceData, m interface{}) erro } func resourceVirtualRepositoryRead(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo, resp, err := c.V1.Repositories.GetVirtual(context.Background(), d.Id()) if resp.StatusCode == http.StatusNotFound { @@ -160,7 +160,7 @@ func resourceVirtualRepositoryRead(d *schema.ResourceData, m interface{}) error } func resourceVirtualRepositoryUpdate(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackVirtualRepository(d) @@ -174,7 +174,7 @@ func resourceVirtualRepositoryUpdate(d *schema.ResourceData, m interface{}) erro } func resourceVirtualRepositoryDelete(d *schema.ResourceData, m interface{}) error { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld repo := unpackVirtualRepository(d) resp, err := c.V1.Repositories.DeleteVirtual(context.Background(), *repo.Key) @@ -186,7 +186,7 @@ func resourceVirtualRepositoryDelete(d *schema.ResourceData, m interface{}) erro } func resourceVirtualRepositoryExists(d *schema.ResourceData, m interface{}) (bool, error) { - c := m.(*artifactory.Artifactory) + c := m.(*ArtClient).ArtOld key := d.Id() _, resp, err := c.V1.Repositories.GetVirtual(context.Background(), key)