Skip to content

Commit 02348e9

Browse files
authored
fix(azure): correct Manged typo in SQL client factory functions (#1809)
* fix(azure): correct Manged typo in SQL client factory functions Four exported functions misspelled "Managed" as "Manged" in modules/azure/client_factory.go: CreateSQLMangedInstanceClient CreateSQLMangedInstanceClientContext CreateSQLMangedDatabasesClient CreateSQLMangedDatabasesClientContext Add the correctly-spelled CreateSQLManaged* functions as the canonical names and convert the typo'd names to // Deprecated: aliases that delegate to them. Update internal call sites in sql_managedinstance.go to use the new spellings. Tagging v1.0 with the typo would lock it into the stable API until a major version bump; the alias approach keeps backwards compatibility while steering new code to the correct names. OSS-3452. * review: drop redundant 'backwards-compatible alias' docstrings on Manged aliases The // Deprecated: line already conveys it; matches the cleanup in the sibling rename PR.
1 parent 82cecb8 commit 02348e9

2 files changed

Lines changed: 34 additions & 14 deletions

File tree

modules/azure/client_factory.go

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ func CreateSQLServerClient(subscriptionID string) (*armsql.ServersClient, error)
489489
return CreateSQLServerClientContext(context.Background(), subscriptionID)
490490
}
491491

492-
// CreateSQLMangedInstanceClientContext is a helper function that will create and setup a sql managed instance client.
492+
// CreateSQLManagedInstanceClientContext is a helper function that will create and setup a sql managed instance client.
493493
// The ctx parameter supports cancellation and timeouts.
494-
func CreateSQLMangedInstanceClientContext(_ context.Context, subscriptionID string) (*armsql.ManagedInstancesClient, error) {
494+
func CreateSQLManagedInstanceClientContext(_ context.Context, subscriptionID string) (*armsql.ManagedInstancesClient, error) {
495495
clientFactory, err := getArmSQLClientFactory(subscriptionID)
496496
if err != nil {
497497
return nil, err
@@ -500,16 +500,26 @@ func CreateSQLMangedInstanceClientContext(_ context.Context, subscriptionID stri
500500
return clientFactory.NewManagedInstancesClient(), nil
501501
}
502502

503-
// CreateSQLMangedInstanceClient is a helper function that will create and setup a sql managed instance client.
503+
// CreateSQLManagedInstanceClient is a helper function that will create and setup a sql managed instance client.
504504
//
505-
// Deprecated: Use [CreateSQLMangedInstanceClientContext] instead.
506-
func CreateSQLMangedInstanceClient(subscriptionID string) (*armsql.ManagedInstancesClient, error) {
507-
return CreateSQLMangedInstanceClientContext(context.Background(), subscriptionID)
505+
// Deprecated: Use [CreateSQLManagedInstanceClientContext] instead.
506+
func CreateSQLManagedInstanceClient(subscriptionID string) (*armsql.ManagedInstancesClient, error) {
507+
return CreateSQLManagedInstanceClientContext(context.Background(), subscriptionID)
508508
}
509509

510-
// CreateSQLMangedDatabasesClientContext is a helper function that will create and setup a sql managed databases client.
510+
// Deprecated: Use [CreateSQLManagedInstanceClientContext] instead.
511+
func CreateSQLMangedInstanceClientContext(ctx context.Context, subscriptionID string) (*armsql.ManagedInstancesClient, error) { //nolint:revive,staticcheck // preserving deprecated function name
512+
return CreateSQLManagedInstanceClientContext(ctx, subscriptionID)
513+
}
514+
515+
// Deprecated: Use [CreateSQLManagedInstanceClient] instead.
516+
func CreateSQLMangedInstanceClient(subscriptionID string) (*armsql.ManagedInstancesClient, error) { //nolint:revive,staticcheck // preserving deprecated function name
517+
return CreateSQLManagedInstanceClient(subscriptionID)
518+
}
519+
520+
// CreateSQLManagedDatabasesClientContext is a helper function that will create and setup a sql managed databases client.
511521
// The ctx parameter supports cancellation and timeouts.
512-
func CreateSQLMangedDatabasesClientContext(_ context.Context, subscriptionID string) (*armsql.ManagedDatabasesClient, error) {
522+
func CreateSQLManagedDatabasesClientContext(_ context.Context, subscriptionID string) (*armsql.ManagedDatabasesClient, error) {
513523
clientFactory, err := getArmSQLClientFactory(subscriptionID)
514524
if err != nil {
515525
return nil, err
@@ -518,11 +528,21 @@ func CreateSQLMangedDatabasesClientContext(_ context.Context, subscriptionID str
518528
return clientFactory.NewManagedDatabasesClient(), nil
519529
}
520530

521-
// CreateSQLMangedDatabasesClient is a helper function that will create and setup a sql managed databases client.
531+
// CreateSQLManagedDatabasesClient is a helper function that will create and setup a sql managed databases client.
522532
//
523-
// Deprecated: Use [CreateSQLMangedDatabasesClientContext] instead.
524-
func CreateSQLMangedDatabasesClient(subscriptionID string) (*armsql.ManagedDatabasesClient, error) {
525-
return CreateSQLMangedDatabasesClientContext(context.Background(), subscriptionID)
533+
// Deprecated: Use [CreateSQLManagedDatabasesClientContext] instead.
534+
func CreateSQLManagedDatabasesClient(subscriptionID string) (*armsql.ManagedDatabasesClient, error) {
535+
return CreateSQLManagedDatabasesClientContext(context.Background(), subscriptionID)
536+
}
537+
538+
// Deprecated: Use [CreateSQLManagedDatabasesClientContext] instead.
539+
func CreateSQLMangedDatabasesClientContext(ctx context.Context, subscriptionID string) (*armsql.ManagedDatabasesClient, error) { //nolint:revive,staticcheck // preserving deprecated function name
540+
return CreateSQLManagedDatabasesClientContext(ctx, subscriptionID)
541+
}
542+
543+
// Deprecated: Use [CreateSQLManagedDatabasesClient] instead.
544+
func CreateSQLMangedDatabasesClient(subscriptionID string) (*armsql.ManagedDatabasesClient, error) { //nolint:revive,staticcheck // preserving deprecated function name
545+
return CreateSQLManagedDatabasesClient(subscriptionID)
526546
}
527547

528548
// getArmSQLClientFactory gets an arm sql client factory

modules/azure/sql_managedinstance.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func GetManagedInstanceContext(t testing.TestingT, ctx context.Context, resGroup
6767
// GetManagedInstanceContextE retrieves the SQL managed instance object for the given subscription.
6868
// The ctx parameter supports cancellation and timeouts.
6969
func GetManagedInstanceContextE(ctx context.Context, subscriptionID string, resGroupName string, managedInstanceName string) (*armsql.ManagedInstance, error) {
70-
sqlmiClient, err := CreateSQLMangedInstanceClientContext(ctx, subscriptionID)
70+
sqlmiClient, err := CreateSQLManagedInstanceClientContext(ctx, subscriptionID)
7171
if err != nil {
7272
return nil, err
7373
}
@@ -117,7 +117,7 @@ func GetManagedInstanceDatabaseContext(t testing.TestingT, ctx context.Context,
117117
// GetManagedInstanceDatabaseContextE retrieves the SQL managed database object for the given subscription.
118118
// The ctx parameter supports cancellation and timeouts.
119119
func GetManagedInstanceDatabaseContextE(ctx context.Context, subscriptionID string, resGroupName string, managedInstanceName string, databaseName string) (*armsql.ManagedDatabase, error) {
120-
sqlmiDBClient, err := CreateSQLMangedDatabasesClientContext(ctx, subscriptionID)
120+
sqlmiDBClient, err := CreateSQLManagedDatabasesClientContext(ctx, subscriptionID)
121121
if err != nil {
122122
return nil, err
123123
}

0 commit comments

Comments
 (0)