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 @@ -418,6 +418,7 @@ func (p *AzureProvider) GetSupportedServices() []common.ServiceType {
common.ServiceRelationalDB,
common.ServiceNoSQL,
common.ServiceCache,
common.ServiceMemoryDB,
common.ServiceSavingsPlans,
common.ServiceSearch,
}
Expand Down Expand Up @@ -473,6 +474,8 @@ func (p *AzureProvider) newServiceClientForSubscription(service common.ServiceTy
return NewCacheClient(p.cred, subscriptionID, region), nil
case common.ServiceNoSQL:
return NewCosmosDBClient(p.cred, subscriptionID, region), nil
case common.ServiceMemoryDB:
return NewManagedRedisClient(p.cred, subscriptionID, region), nil
case common.ServiceSavingsPlans:
return NewSavingsPlansClient(p.cred, subscriptionID, region), nil
case common.ServiceSearch:
Expand Down
3 changes: 3 additions & 0 deletions providers/azure/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ func TestAzureProvider_GetSupportedServices(t *testing.T) {
assert.Contains(t, services, common.ServiceRelationalDB)
assert.Contains(t, services, common.ServiceNoSQL)
assert.Contains(t, services, common.ServiceCache)
assert.Contains(t, services, common.ServiceMemoryDB)
}

func TestAzureProvider_IsConfigured(t *testing.T) {
Expand Down Expand Up @@ -408,6 +409,8 @@ func TestAzureProvider_GetServiceClient_AllServiceTypes(t *testing.T) {
{common.ServiceCompute},
{common.ServiceRelationalDB},
{common.ServiceCache},
{common.ServiceNoSQL},
{common.ServiceMemoryDB},
}

for _, tc := range testCases {
Expand Down
7 changes: 7 additions & 0 deletions providers/azure/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/LeanerCloud/CUDly/providers/azure/services/compute"
"github.com/LeanerCloud/CUDly/providers/azure/services/cosmosdb"
"github.com/LeanerCloud/CUDly/providers/azure/services/database"
"github.com/LeanerCloud/CUDly/providers/azure/services/managedredis"
"github.com/LeanerCloud/CUDly/providers/azure/services/savingsplans"
"github.com/LeanerCloud/CUDly/providers/azure/services/search"
)
Expand All @@ -32,6 +33,12 @@ func NewCosmosDBClient(cred azcore.TokenCredential, subscriptionID, region strin
return cosmosdb.NewClient(cred, subscriptionID, region)
}

// NewManagedRedisClient creates a new Azure Managed Redis client (ServiceMemoryDB).
// Azure Cache for Redis is the Azure equivalent of AWS MemoryDB for Redis.
func NewManagedRedisClient(cred azcore.TokenCredential, subscriptionID, region string) provider.ServiceClient {
return managedredis.NewClient(cred, subscriptionID, region)
}

// NewSavingsPlansClient creates a new Azure Savings Plans client
func NewSavingsPlansClient(cred azcore.TokenCredential, subscriptionID, region string) provider.ServiceClient {
return savingsplans.NewClient(cred, subscriptionID, region)
Expand Down
Loading
Loading