-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Describe the bug
Recent changes to admin.NewThirdPartyIntegration appear to set fields to default values. These fields are serialized, but not accepted by at least one integration (Prometheus)
(Error code: "INVALID_ATTRIBUTE") Detail: Invalid attribute sendCollectionLatencyMetrics specified. Reason: Bad Request. Params: [sendCollectionLatencyMetrics], BadRequestDetail: "}
Expected behavior
No error.
Additional context
SDK version go.mongodb.org/atlas-sdk/v20250312008 v20250312008.0.0
Fix
If I instead of admin.NewThirdPartyIntegration directly construct an empty admin.ThirdPartyIntegration object, the integration works
Sample code
This is the failing code
func createThirdPartyIntegration(config *IntegrationConfig) *admin.ThirdPartyIntegration {
tpi := admin.NewThirdPartyIntegration()
tpi.SetEnabled(true)
tpi.SetType("PROMETHEUS")
tpi.SetServiceDiscovery("http")
tpi.SetUsername(config.PrometheusUsername)
tpi.SetPassword(config.PrometheusPassword)
return tpi
}
func createPrometheusIntegration(ctx context.Context, client *Client, groupID string, config *IntegrationConfig) ([]admin.ThirdPartyIntegration, error) {
tpi := createThirdPartyIntegration(config)
request := client.api.ThirdPartyIntegrationsApi.CreateGroupIntegration(ctx, *tpi.Type, groupID, tpi)
integrations, _, err := request.Execute()
if err != nil {
return nil, err
}
return *integrations.Results, nil
}
Metadata
Metadata
Assignees
Labels
No labels