Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions providers/azure/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func (p *AzureProvider) GetSupportedServices() []common.ServiceType {
common.ServiceMemoryDB,
common.ServiceSavingsPlans,
common.ServiceSearch,
common.ServiceDataWarehouse,
}
}

Expand Down Expand Up @@ -480,6 +481,8 @@ func (p *AzureProvider) newServiceClientForSubscription(service common.ServiceTy
return NewSavingsPlansClient(p.cred, subscriptionID, region), nil
case common.ServiceSearch:
return NewSearchClient(p.cred, subscriptionID, region), nil
case common.ServiceDataWarehouse:
return NewSynapseClient(p.cred, subscriptionID, region), nil
default:
return nil, fmt.Errorf("unsupported service: %s", service)
}
Expand Down
10 changes: 10 additions & 0 deletions providers/azure/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ func TestAzureProvider_GetSupportedServices(t *testing.T) {
assert.Contains(t, services, common.ServiceNoSQL)
assert.Contains(t, services, common.ServiceCache)
assert.Contains(t, services, common.ServiceMemoryDB)
assert.Contains(t, services, common.ServiceSavingsPlans)
assert.Contains(t, services, common.ServiceSearch)
assert.Contains(t, services, common.ServiceDataWarehouse)
}

func TestAzureProvider_IsConfigured(t *testing.T) {
Expand Down Expand Up @@ -411,6 +414,9 @@ func TestAzureProvider_GetServiceClient_AllServiceTypes(t *testing.T) {
{common.ServiceCache},
{common.ServiceNoSQL},
{common.ServiceMemoryDB},
{common.ServiceSavingsPlans},
{common.ServiceSearch},
{common.ServiceDataWarehouse},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -1155,6 +1161,10 @@ func TestAzureProvider_GetServiceClientForAccount(t *testing.T) {
common.ServiceRelationalDB,
common.ServiceCache,
common.ServiceNoSQL,
common.ServiceMemoryDB,
common.ServiceSavingsPlans,
common.ServiceSearch,
common.ServiceDataWarehouse,
}
for _, svc := range services {
t.Run(string(svc), func(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions providers/azure/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/LeanerCloud/CUDly/providers/azure/services/managedredis"
"github.com/LeanerCloud/CUDly/providers/azure/services/savingsplans"
"github.com/LeanerCloud/CUDly/providers/azure/services/search"
"github.com/LeanerCloud/CUDly/providers/azure/services/synapse"
)

// NewComputeClient creates a new Azure Compute (VM) client
Expand Down Expand Up @@ -49,6 +50,11 @@ func NewSearchClient(cred azcore.TokenCredential, subscriptionID, region string)
return search.NewClient(cred, subscriptionID, region)
}

// NewSynapseClient creates a new Azure Synapse Analytics client
func NewSynapseClient(cred azcore.TokenCredential, subscriptionID, region string) provider.ServiceClient {
return synapse.NewClient(cred, subscriptionID, region)
}

// NewRecommendationsClient creates a new Azure recommendations client.
//
// Returns an error when subscriptionID is empty — the adapter's downstream
Expand Down
Loading
Loading