Skip to content

Commit

Permalink
Add ossRDBMSResourceId to Environment configuration. (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbranche authored Jun 1, 2021
1 parent 82fc42f commit 41c23d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions autorest/azure/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type ResourceIdentifier struct {
Datalake string `json:"datalake"`
Batch string `json:"batch"`
OperationalInsights string `json:"operationalInsights"`
OSSRDBMS string `json:"ossRDBMS"`
Storage string `json:"storage"`
Synapse string `json:"synapse"`
ServiceBus string `json:"serviceBus"`
Expand Down Expand Up @@ -116,6 +117,7 @@ var (
Datalake: "https://datalake.azure.net/",
Batch: "https://batch.core.windows.net/",
OperationalInsights: "https://api.loganalytics.io",
OSSRDBMS: "https://ossrdbms-aad.database.windows.net",
Storage: "https://storage.azure.com/",
Synapse: "https://dev.azuresynapse.net",
ServiceBus: "https://servicebus.azure.net/",
Expand Down Expand Up @@ -156,6 +158,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.core.usgovcloudapi.net/",
OperationalInsights: "https://api.loganalytics.us",
OSSRDBMS: "https://ossrdbms-aad.database.usgovcloudapi.net",
Storage: "https://storage.azure.com/",
Synapse: NotAvailable,
ServiceBus: "https://servicebus.azure.net/",
Expand Down Expand Up @@ -196,6 +199,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.chinacloudapi.cn/",
OperationalInsights: NotAvailable,
OSSRDBMS: "https://ossrdbms-aad.database.chinacloudapi.cn",
Storage: "https://storage.azure.com/",
Synapse: "https://dev.azuresynapse.net",
ServiceBus: "https://servicebus.azure.net/",
Expand Down Expand Up @@ -236,6 +240,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.cloudapi.de/",
OperationalInsights: NotAvailable,
OSSRDBMS: "https://ossrdbms-aad.database.cloudapi.de",
Storage: "https://storage.azure.com/",
Synapse: NotAvailable,
ServiceBus: "https://servicebus.azure.net/",
Expand Down
12 changes: 11 additions & 1 deletion autorest/azure/environments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
graphResourceID = "--graph-resource-id--"
keyvaultResourceID = "--keyvault-resource-id--"
opInsightsResourceID = "--operational-insights-resource-id--"
ossRDBMSResourceID = "--oss-rdbms-resource-id--"
)

// This correlates to the expected contents of ./testdata/test_environment_1.json
Expand Down Expand Up @@ -65,6 +66,7 @@ var testEnvironment1 = Environment{
Graph: graphResourceID,
KeyVault: keyvaultResourceID,
OperationalInsights: opInsightsResourceID,
OSSRDBMS: ossRDBMSResourceID,
},
}

Expand Down Expand Up @@ -225,7 +227,8 @@ func TestDeserializeEnvironment(t *testing.T) {
"datalake": "` + datalakeResourceID + `",
"graph": "` + graphResourceID + `",
"keyVault": "` + keyvaultResourceID + `",
"operationalInsights": "` + opInsightsResourceID + `"
"operationalInsights": "` + opInsightsResourceID + `",
"ossRDBMS": "` + ossRDBMSResourceID + `"
}
}`

Expand Down Expand Up @@ -313,6 +316,9 @@ func TestDeserializeEnvironment(t *testing.T) {
if opInsightsResourceID != testSubject.ResourceIdentifiers.OperationalInsights {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be "+opInsightsResourceID+", but got %q", testSubject.ResourceIdentifiers.OperationalInsights)
}
if ossRDBMSResourceID != testSubject.ResourceIdentifiers.OSSRDBMS {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be "+ossRDBMSResourceID+", but got %q", testSubject.ResourceIdentifiers.OSSRDBMS)
}
}

func TestRoundTripSerialization(t *testing.T) {
Expand Down Expand Up @@ -345,6 +351,7 @@ func TestRoundTripSerialization(t *testing.T) {
Graph: graphResourceID,
KeyVault: keyvaultResourceID,
OperationalInsights: opInsightsResourceID,
OSSRDBMS: ossRDBMSResourceID,
},
}

Expand Down Expand Up @@ -440,6 +447,9 @@ func TestRoundTripSerialization(t *testing.T) {
if env.ResourceIdentifiers.OperationalInsights != testSubject.ResourceIdentifiers.OperationalInsights {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be %q, but got %q", env.ResourceIdentifiers.OperationalInsights, testSubject.ResourceIdentifiers.OperationalInsights)
}
if env.ResourceIdentifiers.OSSRDBMS != testSubject.ResourceIdentifiers.OSSRDBMS {
t.Errorf("Expected ResourceIdentifiers.OSSRDBMS to be %q, but got %q", env.ResourceIdentifiers.OSSRDBMS, testSubject.ResourceIdentifiers.OSSRDBMS)
}
}

func TestSetEnvironment(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion autorest/azure/testdata/test_environment_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"datalake": "--datalake-resource-id--",
"graph": "--graph-resource-id--",
"keyVault": "--keyvault-resource-id--",
"operationalInsights": "--operational-insights-resource-id--"
"operationalInsights": "--operational-insights-resource-id--",
"ossRDBMS": "--oss-rdbms-resource-id--"
}
}

0 comments on commit 41c23d2

Please sign in to comment.