Feat/dns zone observability extension#1540
Conversation
f3b6422 to
fc58f24
Compare
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
feat(dns): implement observability extension
fc58f24 to
1eb0838
Compare
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
|
|
|
||
| // getExtensionsPayload reads the extensions from the model and maps it to [dns.ZoneExtensions]. | ||
| // Returns nil if the model does not provide any extensions. | ||
| func getExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) { |
There was a problem hiding this comment.
nitpick, I would rename it to stay consistent to other payload functions
| func getExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) { | |
| func toExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) { |
| observabilityExtension := dns.NewZoneObservabilityExtension(obs.InstanceId.ValueString()) | ||
| return &dns.ZoneExtensions{ | ||
| ObservabilityExtension: observabilityExtension, | ||
| }, nil |
There was a problem hiding this comment.
personal preference, I like this style more, because you can read which attribute is set with which value and without jumping into the function and checking it there
| observabilityExtension := dns.NewZoneObservabilityExtension(obs.InstanceId.ValueString()) | |
| return &dns.ZoneExtensions{ | |
| ObservabilityExtension: observabilityExtension, | |
| }, nil | |
| return &dns.ZoneExtensions{ | |
| ObservabilityExtension: &dns.ZoneObservabilityExtension{ | |
| ObservabilityInstanceId: obs.InstanceId.ValueString(), | |
| }, | |
| }, nil |
| ex := extensions{} | ||
| diags := model.Extensions.As(ctx, &ex, basetypes.ObjectAsOptions{}) | ||
| if diags.HasError() { | ||
| return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors()) |
There was a problem hiding this comment.
| return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors()) | |
| return nil, fmt.Errorf("failed to map extensions to domain type: %w", core.DiagsToError(diags)) |
| obs := observability{} | ||
| diags = ex.Observability.As(ctx, &obs, basetypes.ObjectAsOptions{}) | ||
| if diags.HasError() { | ||
| return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors()) |
There was a problem hiding this comment.
| return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors()) | |
| return nil, fmt.Errorf("failed to map extensions to domain type: %w", core.DiagsToError(diags)) |
| variable "default_ttl" {} | ||
| variable "description" {} | ||
| variable "expire_time" {} | ||
| variable "ext_observability_instance_id" {} |
There was a problem hiding this comment.
is this a testing leftover?
| "ext_observability_instance_id": config.StringVariable("a8f823ad-3abb-47fb-b56a-e3a7e97f65d5"), | ||
| // "ext_observability_state": config.StringVariable("disabled"), |
There was a problem hiding this comment.
same here, testing leftover?
Description
relates to #STACKITTPR-319 and closes #941
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)