Refac/stackittpr 229 provider config builder#1313
Refac/stackittpr 229 provider config builder#1313cgoetz-inovex wants to merge 5 commits intomainfrom
Conversation
- sets region eu01 by default - sets custom endpoints from env vars by default - sets enable beta resoures by default - replace client configuration in acc tests with ConfigBuilder - use ConfigBuilder for provider snippet funcs
- resourcemanager inlined manually - add empty line after provider config
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
| func NewConfigBuilder() *ConfigBuilder { | ||
| b := &ConfigBuilder{ | ||
| region: "eu01", | ||
| enableBetaResources: true, |
There was a problem hiding this comment.
Do we really want to have beta resources enabled by default?
Should be exactly the other way around from my understanding.
There was a problem hiding this comment.
The original was opt-in to beta resources, used true here to save us some configuring in tests.
Is there a downside to this?
There was a problem hiding this comment.
Since the beta resources aren't enabled by default in our provider by default I would expect the same in the test suite.
But I'm a general opt-in guy I would say xD
| opts = append(opts, sdkConf.WithTokenEndpoint(tokenEndPoint)) | ||
| } | ||
| if b.region != "" { | ||
| opts = append(opts, sdkConf.WithRegion(b.region)) |
There was a problem hiding this comment.
Actually the WithRegion is only needed for a subset of services.
You could even get an error for global APIs if you call it.
There was a problem hiding this comment.
So I think it has to stay out of here
| provider "stackit" { | ||
| default_region = "eu01" | ||
| }` | ||
| func (b *ConfigBuilder) BuildClientOptions(service customEndpointConfig) []sdkConf.ConfigurationOption { |
There was a problem hiding this comment.
Pretty nice one btw, thanks for that! 😊
rubenhoenle
left a comment
There was a problem hiding this comment.
See comments above, rest looks great
Description
relates to #1234
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)