Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AzureMonitor: Support querying Subscriptions and Resource Groups in L…
…ogs (#34766) * AzureMonitor: Support querying Subscriptions and Resource Groups in Logs * cleanup (cherry picked from commit 888cddb)
- Loading branch information
1 parent
638735a
commit 45ed259
Showing
8 changed files
with
116 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { parseResourceURI } from './utils'; | ||
|
||
describe('AzureMonitor ResourcePicker utils', () => { | ||
describe('parseResourceURI', () => { | ||
it('should parse subscription URIs', () => { | ||
expect(parseResourceURI('/subscriptions/44693801-6ee6-49de-9b2d-9106972f9572')).toEqual({ | ||
subscriptionID: '44693801-6ee6-49de-9b2d-9106972f9572', | ||
}); | ||
}); | ||
|
||
it('should parse resource group URIs', () => { | ||
expect( | ||
parseResourceURI('/subscriptions/44693801-6ee6-49de-9b2d-9106972f9572/resourceGroups/cloud-datasources') | ||
).toEqual({ | ||
subscriptionID: '44693801-6ee6-49de-9b2d-9106972f9572', | ||
resourceGroup: 'cloud-datasources', | ||
}); | ||
}); | ||
|
||
it('should parse resource URIs', () => { | ||
expect( | ||
parseResourceURI( | ||
'/subscriptions/44693801-6ee6-49de-9b2d-9106972f9572/resourceGroups/cloud-datasources/providers/Microsoft.Compute/virtualMachines/GithubTestDataVM' | ||
) | ||
).toEqual({ | ||
subscriptionID: '44693801-6ee6-49de-9b2d-9106972f9572', | ||
resourceGroup: 'cloud-datasources', | ||
resource: 'GithubTestDataVM', | ||
}); | ||
}); | ||
|
||
it('returns undefined for invalid input', () => { | ||
expect(parseResourceURI('44693801-6ee6-49de-9b2d-9106972f9572')).toBeUndefined(); | ||
}); | ||
}); | ||
}); |
13 changes: 10 additions & 3 deletions
13
...pp/plugins/datasource/grafana-azure-monitor-datasource/components/ResourcePicker/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters