From 511e334544e0d647419e84d0f2f65f573bea1f65 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Sun, 21 Jan 2024 18:06:24 -0500 Subject: [PATCH] changes from GoLand --- .gitignore | 1 - CONTRIBUTING.md | 8 +++---- README.md | 2 +- go.mod | 8 +------ go.sum | 23 ------------------- opslevel/common.go | 12 +++++----- .../resource_opslevel_check_custom_event.go | 4 ++-- ...source_opslevel_check_has_recent_deploy.go | 2 +- opslevel/resource_opslevel_check_manual.go | 2 +- ...resource_opslevel_check_repository_grep.go | 2 +- ...source_opslevel_check_service_ownership.go | 4 ++-- opslevel/resource_opslevel_integration_aws.go | 4 ++-- opslevel/resource_opslevel_repository.go | 1 + opslevel/resource_opslevel_scorecard.go | 2 +- opslevel/resource_opslevel_service.go | 2 +- opslevel/resource_opslevel_team.go | 14 +++++------ .../resource_opslevel_trigger_definition.go | 4 ++-- opslevel/version.go | 2 +- 18 files changed, 34 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index 65ba7aa3..592a48b2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ website/node_modules .idea *.iml *.test -*.iml website/vendor diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afe9a053..81b33e70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,10 @@ # Contributing 1. [About this document](#about-this-document) -3. [Getting the code](#getting-the-code) -4. [Setting up an environment](#setting-up-an-environment) -5. [Local development](#local-development) -7. [Submitting a Pull Request](#submitting-a-pull-request) +2. [Getting the code](#getting-the-code) +3. [Setting up an environment](#setup-a-terraform-workspace) +4. [Local development](#setting-up-an-environment-for-local-development) +5. [Submitting a Pull Request](#submitting-a-pull-request) ## About this document diff --git a/README.md b/README.md index 391dff64..ed748a1d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- + diff --git a/go.mod b/go.mod index 0b8d1c53..39202b46 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21 require ( github.com/hashicorp/terraform-plugin-sdk v1.17.2 + github.com/mitchellh/mapstructure v1.5.0 github.com/opslevel/opslevel-go/v2024 v2024.1.13 github.com/rs/zerolog v1.31.0 ) @@ -40,7 +41,6 @@ require ( github.com/gosimple/slug v1.13.1 // indirect github.com/gosimple/unidecode v1.0.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.3 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect @@ -50,11 +50,7 @@ require ( github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.4.0 // indirect github.com/hashicorp/hcl/v2 v2.19.1 // indirect - github.com/hashicorp/terraform-exec v0.17.2 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-docs v0.13.0 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hasura/go-graphql-client v0.10.2 // indirect @@ -70,13 +66,11 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.1.0 // indirect github.com/opslevel/moredefaults v0.0.0-20240112142637-078c8ff8ba9c // indirect github.com/posener/complete v1.2.3 // indirect github.com/relvacode/iso8601 v1.3.0 // indirect - github.com/russross/blackfriday v1.6.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect diff --git a/go.sum b/go.sum index 1bb42a91..6b5509e9 100644 --- a/go.sum +++ b/go.sum @@ -205,8 +205,6 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= @@ -288,12 +286,8 @@ github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aev github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -429,7 +423,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb 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= -github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -459,13 +452,10 @@ github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= -github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+DbLISwf2B8WXEolNRA8BGCwI9jws= github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= @@ -477,13 +467,7 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 h1:Pc5TCv9mbxFN6UVX0LH6CpQrdTM5YjbVI2w15237Pjk= github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A= github.com/hashicorp/terraform-exec v0.13.3/go.mod h1:SSg6lbUsVB3DmFyCPjBPklqf6EYGX0TlQ6QTxOlikDU= -github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go= -github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8= github.com/hashicorp/terraform-json v0.10.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= -github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= -github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= -github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= github.com/hashicorp/terraform-plugin-sdk v1.17.2 h1:V7DUR3yBWFrVB9z3ddpY7kiYVSsq4NYR67NiTs93NQo= github.com/hashicorp/terraform-plugin-sdk v1.17.2/go.mod h1:wkvldbraEMkz23NxkkAsFS88A1R9eUiooiaUZyS6TLw= github.com/hashicorp/terraform-plugin-test/v2 v2.2.1/go.mod h1:eZ9JL3O69Cb71Skn6OhHyj17sLmHRb+H6VrDcJjKrYU= @@ -541,7 +525,6 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -614,9 +597,6 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= -github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= -github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= @@ -673,7 +653,6 @@ github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLE github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.8.2/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= @@ -702,7 +681,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -894,7 +872,6 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/opslevel/common.go b/opslevel/common.go index ad1b5e43..1c44131a 100644 --- a/opslevel/common.go +++ b/opslevel/common.go @@ -200,7 +200,7 @@ func expandPredicateUpdate(d *schema.ResourceData, key string) *opslevel.Predica } func flattenPredicate(input *opslevel.Predicate) []map[string]string { - output := []map[string]string{} + output := make([]map[string]string, 0) if input != nil { output = append(output, map[string]string{ "type": string(input.Type), @@ -305,7 +305,7 @@ func flattenTag(tag opslevel.Tag) string { } func flattenTagArray(tags []opslevel.Tag) []string { - output := []string{} + output := make([]string, 0) for _, tag := range tags { output = append(output, flattenTag(tag)) } @@ -313,7 +313,7 @@ func flattenTagArray(tags []opslevel.Tag) []string { } func flattenServiceRepositoriesArray(repositories *opslevel.ServiceRepositoryConnection) []string { - output := []string{} + output := make([]string, 0) for _, rep := range repositories.Edges { output = append(output, string(rep.Node.Id)) } @@ -321,7 +321,7 @@ func flattenServiceRepositoriesArray(repositories *opslevel.ServiceRepositoryCon } func mapMembershipsArray(members *opslevel.TeamMembershipConnection) []map[string]string { - output := []map[string]string{} + output := make([]map[string]string, 0) for _, membership := range members.Nodes { asMap := make(map[string]string) asMap["email"] = membership.User.Email @@ -332,7 +332,7 @@ func mapMembershipsArray(members *opslevel.TeamMembershipConnection) []map[strin } func mapServiceProperties(properties *opslevel.ServicePropertiesConnection) []map[string]any { - output := []map[string]any{} + output := make([]map[string]any, 0) for _, property := range properties.Nodes { asMap := make(map[string]any) asMap["definition"] = string(property.Definition.Id) @@ -348,7 +348,7 @@ func mapServiceProperties(properties *opslevel.ServicePropertiesConnection) []ma } func flattenTeamsArray(teams *opslevel.TeamConnection) []string { - output := []string{} + output := make([]string, 0) for _, team := range teams.Nodes { output = append(output, team.Alias) } diff --git a/opslevel/resource_opslevel_check_custom_event.go b/opslevel/resource_opslevel_check_custom_event.go index 4fc803b7..8fa52e5c 100644 --- a/opslevel/resource_opslevel_check_custom_event.go +++ b/opslevel/resource_opslevel_check_custom_event.go @@ -55,7 +55,7 @@ func resourceCheckCustomEventCreate(d *schema.ResourceData, client *opslevel.Cli input := opslevel.NewCheckCreateInputTypeOf[opslevel.CheckCustomEventCreateInput](checkCreateInput) input.IntegrationId = *opslevel.NewID(d.Get("integration").(string)) - input.PassPending = opslevel.Bool(d.Get("pass_pending").(bool)) + input.PassPending = opslevel.RefTo(d.Get("pass_pending").(bool)) input.ServiceSelector = d.Get("service_selector").(string) input.SuccessCondition = d.Get("success_condition").(string) input.ResultMessage = opslevel.RefOf(d.Get("message").(string)) @@ -114,7 +114,7 @@ func resourceCheckCustomEventUpdate(d *schema.ResourceData, client *opslevel.Cli if d.HasChange("integration") { input.IntegrationId = opslevel.NewID(d.Get("integration").(string)) } - input.PassPending = opslevel.Bool(d.Get("pass_pending").(bool)) + input.PassPending = opslevel.RefTo(d.Get("pass_pending").(bool)) if d.HasChange("service_selector") { input.ServiceSelector = opslevel.RefOf(d.Get("service_selector").(string)) } diff --git a/opslevel/resource_opslevel_check_has_recent_deploy.go b/opslevel/resource_opslevel_check_has_recent_deploy.go index a3ecca54..68fd5fa4 100644 --- a/opslevel/resource_opslevel_check_has_recent_deploy.go +++ b/opslevel/resource_opslevel_check_has_recent_deploy.go @@ -62,7 +62,7 @@ func resourceCheckHasRecentDeployUpdate(d *schema.ResourceData, client *opslevel checkUpdateInput := getCheckUpdateInputFrom(d) input := opslevel.NewCheckUpdateInputTypeOf[opslevel.CheckHasRecentDeployUpdateInput](checkUpdateInput) if d.HasChange("days") { - input.Days = opslevel.NewInt(d.Get("days").(int)) + input.Days = opslevel.RefTo(d.Get("days").(int)) } _, err := client.UpdateCheckHasRecentDeploy(*input) diff --git a/opslevel/resource_opslevel_check_manual.go b/opslevel/resource_opslevel_check_manual.go index 5b22b302..d3d65f70 100644 --- a/opslevel/resource_opslevel_check_manual.go +++ b/opslevel/resource_opslevel_check_manual.go @@ -84,7 +84,7 @@ func expandUpdateFrequencyOnUpdate(d *schema.ResourceData, key string) *opslevel } func flattenUpdateFrequency(input *opslevel.ManualCheckFrequency) []map[string]interface{} { - output := []map[string]interface{}{} + output := make([]map[string]interface{}, 0) if input != nil { output = append(output, map[string]interface{}{ "starting_data": input.StartingDate.Format(time.RFC3339), diff --git a/opslevel/resource_opslevel_check_repository_grep.go b/opslevel/resource_opslevel_check_repository_grep.go index 767c99ec..efe5bce4 100644 --- a/opslevel/resource_opslevel_check_repository_grep.go +++ b/opslevel/resource_opslevel_check_repository_grep.go @@ -45,7 +45,7 @@ func resourceCheckRepositoryGrepCreate(d *schema.ResourceData, client *opslevel. fileContentsPredicate := expandPredicate(d, "file_contents_predicate") if fileContentsPredicate == nil { input.FileContentsPredicate = opslevel.PredicateInput{ - Type: opslevel.PredicateTypeEnum("exists"), + Type: "exists", } } diff --git a/opslevel/resource_opslevel_check_service_ownership.go b/opslevel/resource_opslevel_check_service_ownership.go index 97802d6f..c0a06137 100644 --- a/opslevel/resource_opslevel_check_service_ownership.go +++ b/opslevel/resource_opslevel_check_service_ownership.go @@ -45,7 +45,7 @@ func resourceCheckServiceOwnershipCreate(d *schema.ResourceData, client *opsleve checkCreateInput := getCheckCreateInputFrom(d) input := opslevel.NewCheckCreateInputTypeOf[opslevel.CheckServiceOwnershipCreateInput](checkCreateInput) - input.RequireContactMethod = opslevel.Bool(d.Get("require_contact_method").(bool)) + input.RequireContactMethod = opslevel.RefTo(d.Get("require_contact_method").(bool)) if value, ok := d.GetOk("contact_method"); ok { contactMethod := opslevel.ContactType(value.(string)) input.ContactMethod = opslevel.RefOf(string(contactMethod)) @@ -104,7 +104,7 @@ func resourceCheckServiceOwnershipRead(d *schema.ResourceData, client *opslevel. func resourceCheckServiceOwnershipUpdate(d *schema.ResourceData, client *opslevel.Client) error { checkUpdateInput := getCheckUpdateInputFrom(d) input := opslevel.NewCheckUpdateInputTypeOf[opslevel.CheckServiceOwnershipUpdateInput](checkUpdateInput) - input.RequireContactMethod = opslevel.Bool(d.Get("require_contact_method").(bool)) + input.RequireContactMethod = opslevel.RefTo(d.Get("require_contact_method").(bool)) if d.HasChange("contact_method") { contactMethod := opslevel.ContactType(d.Get("contact_method").(string)) diff --git a/opslevel/resource_opslevel_integration_aws.go b/opslevel/resource_opslevel_integration_aws.go index 5e2969a2..85a1be77 100644 --- a/opslevel/resource_opslevel_integration_aws.go +++ b/opslevel/resource_opslevel_integration_aws.go @@ -61,7 +61,7 @@ func resourceIntegrationAWSCreate(d *schema.ResourceData, client *opslevel.Clien Name: opslevel.RefOf(d.Get("name").(string)), IAMRole: opslevel.RefOf(d.Get("iam_role").(string)), ExternalID: opslevel.RefOf(d.Get("external_id").(string)), - OwnershipTagOverride: opslevel.Bool(d.Get("ownership_tag_overrides").(bool)), + OwnershipTagOverride: opslevel.RefTo(d.Get("ownership_tag_overrides").(bool)), } input.OwnershipTagKeys = getStringArray(d, "ownership_tag_keys") @@ -106,7 +106,7 @@ func resourceIntegrationAWSUpdate(d *schema.ResourceData, client *opslevel.Clien Name: opslevel.RefOf(d.Get("name").(string)), IAMRole: opslevel.RefOf(d.Get("iam_role").(string)), ExternalID: opslevel.RefOf(d.Get("external_id").(string)), - OwnershipTagOverride: opslevel.Bool(d.Get("ownership_tag_overrides").(bool)), + OwnershipTagOverride: opslevel.RefTo(d.Get("ownership_tag_overrides").(bool)), } input.OwnershipTagKeys = getStringArray(d, "ownership_tag_keys") diff --git a/opslevel/resource_opslevel_repository.go b/opslevel/resource_opslevel_repository.go index d88dac17..06ae1b37 100644 --- a/opslevel/resource_opslevel_repository.go +++ b/opslevel/resource_opslevel_repository.go @@ -92,6 +92,7 @@ func resourceRepositoryUpdate(d *schema.ResourceData, client *opslevel.Client) e return resourceRepositoryRead(d, client) } +//goland:noinspection GoUnusedParameter func resourceRepositoryDelete(d *schema.ResourceData, client *opslevel.Client) error { // No API call to make because the repository is not able to be deleted d.SetId("") diff --git a/opslevel/resource_opslevel_scorecard.go b/opslevel/resource_opslevel_scorecard.go index 3e29d17e..5e62a70a 100644 --- a/opslevel/resource_opslevel_scorecard.go +++ b/opslevel/resource_opslevel_scorecard.go @@ -14,7 +14,7 @@ func handleInput(d *schema.ResourceData) opslevel.ScorecardInput { OwnerId: *opslevel.NewID(d.Get("owner_id").(string)), Description: &description, FilterId: opslevel.NewID(d.Get("filter_id").(string)), - AffectsOverallServiceLevels: opslevel.Bool(d.Get("affects_overall_service_levels").(bool)), + AffectsOverallServiceLevels: opslevel.RefTo(d.Get("affects_overall_service_levels").(bool)), } return input diff --git a/opslevel/resource_opslevel_service.go b/opslevel/resource_opslevel_service.go index 551493fc..10f50532 100644 --- a/opslevel/resource_opslevel_service.go +++ b/opslevel/resource_opslevel_service.go @@ -240,7 +240,7 @@ func resourceServiceRead(d *schema.ResourceData, client *opslevel.Client) error if opslevel.IsID(owner.(string)) { ownerValue = string(resource.Owner.Id) } else { - ownerValue = string(resource.Owner.Alias) + ownerValue = resource.Owner.Alias } if err := d.Set("owner", ownerValue); err != nil { diff --git a/opslevel/resource_opslevel_team.go b/opslevel/resource_opslevel_team.go index c9fe4e30..ee17a8db 100644 --- a/opslevel/resource_opslevel_team.go +++ b/opslevel/resource_opslevel_team.go @@ -101,7 +101,7 @@ func reconcileTeamAliases(d *schema.ResourceData, team *opslevel.Team, client *o } func collectMembersFromTeam(team *opslevel.Team) []opslevel.TeamMembershipUserInput { - members := []opslevel.TeamMembershipUserInput{} + members := make([]opslevel.TeamMembershipUserInput, 0) for _, user := range team.Memberships.Nodes { newUserIdentifier := opslevel.NewUserIdentifier(user.User.Email) @@ -124,7 +124,7 @@ func memberInArray(member opslevel.TeamMembershipUserInput, array []opslevel.Tea } func reconcileTeamMembership(d *schema.ResourceData, team *opslevel.Team, client *opslevel.Client) error { - expectedMembers := []opslevel.TeamMembershipUserInput{} + expectedMembers := make([]opslevel.TeamMembershipUserInput, 0) existingMembers := collectMembersFromTeam(team) if members, ok := d.GetOk("member"); ok { @@ -141,8 +141,8 @@ func reconcileTeamMembership(d *schema.ResourceData, team *opslevel.Team, client } } - membersToRemove := []opslevel.TeamMembershipUserInput{} - membersToAdd := []opslevel.TeamMembershipUserInput{} + membersToRemove := make([]opslevel.TeamMembershipUserInput, 0) + membersToAdd := make([]opslevel.TeamMembershipUserInput, 0) for _, existingMember := range existingMembers { if memberInArray(existingMember, expectedMembers) { @@ -228,7 +228,7 @@ func resourceTeamRead(d *schema.ResourceData, client *opslevel.Client) error { if opslevel.IsID(parent.(string)) { parentValue = string(resource.ParentTeam.Id) } else { - parentValue = string(resource.ParentTeam.Alias) + parentValue = resource.ParentTeam.Alias } if err := d.Set("parent", parentValue); err != nil { @@ -236,7 +236,7 @@ func resourceTeamRead(d *schema.ResourceData, client *opslevel.Client) error { } } - aliases := []string{} + aliases := make([]string, 0) for _, alias := range resource.Aliases { if alias == resource.Alias { // If user specifies the auto-generated alias in terraform config, don't skip it @@ -258,7 +258,7 @@ func resourceTeamRead(d *schema.ResourceData, client *opslevel.Client) error { // the config or unassigning all the members (unwanted) if members, ok := d.GetOk("member"); members != nil || ok { members := collectMembersFromTeam(resource) - memberOutput := []map[string]interface{}{} + memberOutput := make([]map[string]interface{}, 0) for _, m := range members { mOutput := make(map[string]interface{}) mOutput["email"] = m.User.Email diff --git a/opslevel/resource_opslevel_trigger_definition.go b/opslevel/resource_opslevel_trigger_definition.go index 75af173c..1a800734 100644 --- a/opslevel/resource_opslevel_trigger_definition.go +++ b/opslevel/resource_opslevel_trigger_definition.go @@ -120,7 +120,7 @@ func resourceTriggerDefinitionCreate(d *schema.ResourceData, client *opslevel.Cl input.ResponseTemplate = opslevel.RefOf(responseTemplate) } - input.Published = opslevel.Bool(d.Get("published").(bool)) + input.Published = opslevel.RefTo(d.Get("published").(bool)) if _, ok := d.GetOk("entity_type"); ok { entityType := d.Get("entity_type").(string) @@ -217,7 +217,7 @@ func resourceTriggerDefinitionUpdate(d *schema.ResourceData, client *opslevel.Cl input.FilterId = opslevel.NewID(d.Get("filter").(string)) } - input.Published = opslevel.Bool(d.Get("published").(bool)) + input.Published = opslevel.RefTo(d.Get("published").(bool)) if d.HasChange("access_control") { input.AccessControl = opslevel.RefOf(opslevel.CustomActionsTriggerDefinitionAccessControlEnum(d.Get("access_control").(string))) diff --git a/opslevel/version.go b/opslevel/version.go index 23a485c4..83ca6e11 100644 --- a/opslevel/version.go +++ b/opslevel/version.go @@ -1,3 +1,3 @@ package opslevel -var version string = "dev" +var version = "dev"