Skip to content

Commit ebcb683

Browse files
committed
REWRITE: replace Netlify API code generation tool
1 parent 38c412e commit ebcb683

File tree

604 files changed

+111620
-65066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

604 files changed

+111620
-65066
lines changed

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Terraform Provider",
6+
"type": "go",
7+
"request": "launch",
8+
"mode": "debug",
9+
// this assumes your workspace is the root of the repo
10+
"program": "${workspaceFolder}",
11+
"env": {},
12+
"args": [
13+
"-debug",
14+
]
15+
}
16+
]
17+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"go.lintFlags": [
3+
"--fast"
4+
],
5+
"go.lintTool": "golangci-lint"
6+
}

GNUmakefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
.PHONY: all build deps generate help test validate
1+
.PHONY: all build deps generate help test openapi_generate
22
SWAGGER_SPEC=swagger.yml
33

44
help: ## Show this help.
55
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
66

7-
all: deps generate test testacc # build ## Validate the swagger spec, generate the code and build it.
7+
all: deps openapi_generate generate test testacc # build
88

9-
# build: ## Build the API Go client.
10-
# go build ./go/...
9+
# build: ## Build Terraform provider.
10+
# go build ???
1111

12-
deps: ## Download dependencies.
12+
deps: ## Install dependencies.
1313
go mod download
1414

15-
generate: validate ## Generate the API Go client and the JSON document for the UI.
15+
generate: ## Generate Terraform docs.
1616
go generate
1717

18+
openapi_generate: ## Generate the go code from the OpenAPI spec.
19+
docker run --rm \
20+
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
21+
--additional-properties=disallowAdditionalPropertiesIfNotPresent=false,isGoSubmodule=true,packageName=netlifyapi,withGoMod=false \
22+
--global-property apiDocs=false,modelDocs=false,apiTests=false,modelTests=false \
23+
-i /local/openapi.json \
24+
-g go \
25+
-o /local/internal/netlifyapi ; \
26+
sed -i '' 's/int32/int64/g' internal/netlifyapi/model_*.go ; \
27+
sed -i '' 's/int32/int64/g' internal/netlifyapi/api_*.go
28+
1829
test: ## Test the go code.
1930
go test -v ./...
2031

2132
testacc:
2233
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
23-
24-
validate: deps ## Check that the swagger spec is valid.
25-
go run github.com/go-swagger/go-swagger/cmd/swagger validate $(SWAGGER_SPEC)

UPDATING_OPENAPI_JSON.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Updating swagger.yml
2+
3+
**This is a temporary measure. Feedback will be shared to fix upstream.**
4+
5+
This project uses a modified `openapi.json`. Please maintain these instructions and follow them carefully.
6+
7+
1. Take the latest `openapi-external.json` from [netlify/bitballoon-openapi](https://github.dev/netlify/bitballoon-openapi/blob/main/openapi-external.json).
8+
1. Remove the billing_details property from the `Account` object (also from the `required` array).
9+
1. Fix the type of `Repo.base_rel_dir` to `boolean`.
10+
1. Remove all required properties from the `Repo` object (manual builds).
11+
1. Remove the `domain` property from the `required` array of the `DnsZone` object.
12+
1. Remove the `values`, `scopes` and `is_secret` parameters from the `updateEnvVar` operation.
13+
1. Add a request body schema to the `updateEnvVar` operation, by copying it from an earlier version of the `openapi.json`.

UPDATING_SWAGGER_YML.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ The Netlify provider provides resources to interact with a Netlify account.
1414

1515
### Optional
1616

17-
- `endpoint` (String) Defaults to: https://api.netlify.com/api/v1/
17+
- `endpoint` (String) Defaults to: https://api.netlify.com
1818
- `token` (String, Sensitive) Read: https://docs.netlify.com/api/get-started/

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ require (
1111
github.com/go-swagger/go-swagger v0.30.5
1212
github.com/hashicorp/terraform-plugin-docs v0.19.2
1313
github.com/hashicorp/terraform-plugin-framework v1.8.0
14+
golang.org/x/oauth2 v0.17.0
1415
)
1516

17+
require google.golang.org/appengine v1.6.8 // indirect
18+
1619
require (
1720
github.com/BurntSushi/toml v1.3.2 // indirect
1821
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013 h1:l
8686
github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013/go.mod h1:b65mBPzqzZWxOZGxSWrqs4GInLIn+u99Q9q7p+GKni0=
8787
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
8888
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
89+
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
90+
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
8991
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
9092
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
93+
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
9194
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
9295
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
9396
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -293,6 +296,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
293296
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
294297
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
295298
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
299+
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ=
300+
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA=
296301
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
297302
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
298303
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
@@ -319,6 +324,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
319324
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
320325
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
321326
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
327+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
322328
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
323329
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
324330
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
@@ -328,10 +334,15 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
328334
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
329335
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
330336
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
337+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
338+
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
339+
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
331340
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE=
332341
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
333342
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
334343
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
344+
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
345+
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
335346
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
336347
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
337348
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/models/access_token.go

Lines changed: 0 additions & 62 deletions
This file was deleted.

internal/models/account_add_member_setup.go

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)