Skip to content

Commit e7c3a30

Browse files
Fix lint issues
1 parent a885285 commit e7c3a30

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

.changelog/3680.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
```release-note:enhancement
2-
streamconnection/resource_stream_connection: Add new authentication mechanism(OIDC) to the Kafka connection
2+
resource/mongodbatlas_stream_connection: Add new authentication mechanism(OIDC) to the Kafka connection
33
```

internal/service/streamconnection/model_stream_connection_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ import (
1111
)
1212

1313
const (
14-
connectionName = "Connection"
15-
typeValue = ""
16-
clusterName = "Cluster0"
17-
dummyProjectID = "111111111111111111111111"
18-
instanceName = "InstanceName"
19-
authMechanism = "PLAIN"
20-
authMechanismOAuth = "OAUTHBEARER"
21-
authUsername = "user1"
22-
clientID = "auth0Client"
23-
clientSecret = "secret"
14+
connectionName = "Connection"
15+
typeValue = ""
16+
clusterName = "Cluster0"
17+
dummyProjectID = "111111111111111111111111"
18+
instanceName = "InstanceName"
19+
authMechanism = "PLAIN"
20+
authMechanismOAuth = "OAUTHBEARER"
21+
authUsername = "user1"
22+
clientID = "auth0Client"
23+
clientSecret = "secret"
24+
// #nosec G101
2425
tokenEndpointURL = "https://your-domain.com/oauth2/token"
2526
scope = "read:messages write:messages"
2627
saslOauthbearerExtentions = "logicalCluster=cluster-kmo17m,identityPoolId=pool-l7Arl"
@@ -642,13 +643,13 @@ func tfAuthenticationObject(t *testing.T, mechanism, username, password string)
642643
return auth
643644
}
644645

645-
func tfAuthenticationObjectForOAuth(t *testing.T, mechanism, clientId, clientSecret, tokenEndpointUrl, scope, saslOauthbearerExtensions, httpsCaPem string) types.Object {
646+
func tfAuthenticationObjectForOAuth(t *testing.T, mechanism, clientID, clientSecret, tokenEndpointURL, scope, saslOauthbearerExtensions, httpsCaPem string) types.Object {
646647
t.Helper()
647648
auth, diags := types.ObjectValueFrom(t.Context(), streamconnection.ConnectionAuthenticationObjectType.AttrTypes, streamconnection.TFConnectionAuthenticationModel{
648649
Mechanism: types.StringValue(mechanism),
649-
ClientID: types.StringValue(clientId),
650+
ClientID: types.StringValue(clientID),
650651
ClientSecret: types.StringValue(clientSecret),
651-
TokenEndpointURL: types.StringValue(tokenEndpointUrl),
652+
TokenEndpointURL: types.StringValue(tokenEndpointURL),
652653
Scope: types.StringValue(scope),
653654
SaslOauthbearerExtensions: types.StringValue(saslOauthbearerExtensions),
654655
HTTPSCaPem: types.StringValue(httpsCaPem),

internal/service/streamconnection/resource_stream_connection_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func TestAccStreamRSStreamConnection_AWSLambda(t *testing.T) {
404404
})
405405
}
406406

407-
func getKafkaAuthenticationConfig(mechanism, username, password, tokenEndpointUrl, clientId, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem string) string {
407+
func getKafkaAuthenticationConfig(mechanism, username, password, tokenEndpointURL, clientID, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem string) string {
408408
if mechanism == "PLAIN" {
409409
return fmt.Sprintf(`authentication = {
410410
mechanism = %[1]q
@@ -420,8 +420,7 @@ func getKafkaAuthenticationConfig(mechanism, username, password, tokenEndpointUr
420420
scope = %[5]q
421421
sasl_oauthbearer_extensions = %[6]q
422422
https_ca_pem = %[7]q
423-
}`, mechanism, tokenEndpointUrl, clientId, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem)
424-
423+
}`, mechanism, tokenEndpointURL, clientID, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem)
425424
}
426425

427426
func configureKafka(projectID, instanceName, connectionName, authenticationConfig, bootstrapServers, configValue, networkingConfig string, useSSL bool) string {
@@ -524,16 +523,16 @@ func checkKafkaAttributes(
524523
}
525524

526525
func checkKafkaOAuthAttributes(
527-
resourceName, instanceName, connectionName, tokenEndpointUrl, clientId, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem, bootstrapServers, configValue, networkingType string, usesSSL, checkClientSecret bool) resource.TestCheckFunc {
526+
resourceName, instanceName, connectionName, tokenEndpointURL, clientID, clientSecret, scope, saslOauthbearerExtensions, httpsCaPem, bootstrapServers, configValue, networkingType string, usesSSL, checkClientSecret bool) resource.TestCheckFunc {
528527
resourceChecks := []resource.TestCheckFunc{
529528
checkStreamConnectionExists(),
530529
resource.TestCheckResourceAttrSet(resourceName, "project_id"),
531530
resource.TestCheckResourceAttr(resourceName, "connection_name", connectionName),
532531
resource.TestCheckResourceAttr(resourceName, "type", "Kafka"),
533532
resource.TestCheckResourceAttr(resourceName, "instance_name", instanceName),
534533
resource.TestCheckResourceAttr(resourceName, "authentication.mechanism", "OAUTHBEARER"),
535-
resource.TestCheckResourceAttr(resourceName, "authentication.token_endpoint_url", tokenEndpointUrl),
536-
resource.TestCheckResourceAttr(resourceName, "authentication.client_id", clientId),
534+
resource.TestCheckResourceAttr(resourceName, "authentication.token_endpoint_url", tokenEndpointURL),
535+
resource.TestCheckResourceAttr(resourceName, "authentication.client_id", clientID),
537536
resource.TestCheckResourceAttr(resourceName, "authentication.scope", scope),
538537
resource.TestCheckResourceAttr(resourceName, "authentication.sasl_oauthbearer_extensions", saslOauthbearerExtensions),
539538
resource.TestCheckResourceAttr(resourceName, "authentication.https_ca_pem", httpsCaPem),

0 commit comments

Comments
 (0)