Add support for CosmosDB - Mongo API (#19386)

* Display cdb nodes to browse azure tree

* Update icons

* Update node label

* Remove console logs

* Fix i18n in cosmosDbMongoTreeDataProvider

* Disable Mongo provider in azure tree for now

* Revert "Disable Mongo provider in azure tree for now"

This reverts commit 8b2d2079f43624596a41b82a71a5e40eef1ad4b1.

* Fix build issues related to merge

* Add COSMOSDB_MONGO in provider extension map

* Define providerId string as constant. Rename constants to follow azurecore/ naming conventions (all caps)
This commit is contained in:
Laurent Nguyen
2022-05-19 20:12:53 +02:00
committed by GitHub
parent 1bceb04a4a
commit 97a4ecdfbb
9 changed files with 191 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_725:32860)">
<path d="M1.92584 4.68122C1.88418 4.68135 1.84417 4.66492 1.81462 4.63555C1.78507 4.60617 1.7684 4.56627 1.76827 4.5246C1.76506 3.53697 0.962946 2.73832 -0.0247012 2.7394C-0.0826423 2.74262 -0.137618 2.71355 -0.167561 2.66385C-0.197503 2.61412 -0.197503 2.55195 -0.167561 2.50222C-0.137618 2.45252 -0.0826423 2.42344 -0.0247012 2.42667C0.963056 2.42801 1.76533 1.62921 1.76827 0.641457C1.76827 0.554162 1.83903 0.483395 1.92633 0.483395C2.01362 0.483395 2.08439 0.554162 2.08439 0.641457C2.0876 1.62948 2.89031 2.42828 3.87834 2.42667C3.96481 2.42667 4.03494 2.49678 4.03494 2.58327C4.03494 2.66977 3.96481 2.73987 3.87834 2.73987C2.89031 2.73827 2.0876 3.53707 2.08439 4.5251C2.08413 4.56685 2.06727 4.60677 2.03752 4.63607C2.00778 4.66535 1.96759 4.6816 1.92584 4.68122Z" fill="white"/>
<path d="M12.9813 14.751C12.9296 14.751 12.8875 14.7092 12.8873 14.6575C12.8849 14.0673 12.4055 13.5902 11.8153 13.5908C11.7636 13.5908 11.7217 13.5489 11.7217 13.4972C11.7217 13.4455 11.7636 13.4036 11.8153 13.4036C12.4055 13.4042 12.8849 12.9272 12.8873 12.337C12.8873 12.285 12.9294 12.2429 12.9813 12.2429C13.0333 12.2429 13.0754 12.285 13.0754 12.337C13.0778 12.9272 13.5572 13.4042 14.1474 13.4036C14.1991 13.4036 14.241 13.4455 14.241 13.4972C14.241 13.5489 14.1991 13.5908 14.1474 13.5908C13.5572 13.5902 13.0778 14.0673 13.0754 14.6575C13.0754 14.6824 13.0655 14.7062 13.0478 14.7238C13.0302 14.7414 13.0062 14.7512 12.9813 14.751Z" fill="white"/>
<path d="M5.39249 12.6482C6.97109 13.4359 8.84442 13.3531 10.3474 12.4292C11.8503 11.5054 12.7701 9.8713 12.7801 8.10712C11.6963 9.07732 10.5245 9.94457 9.27999 10.6977C8.04727 11.4666 6.74584 12.1196 5.39249 12.6482Z" fill="white"/>
<path d="M8.433 9.31202C9.7825 8.50402 11.0351 7.54424 12.1663 6.45139C12.2589 6.35929 12.3414 6.27492 12.4194 6.19395C12.1976 5.63 11.8764 5.11042 11.4711 4.6599C10.1951 3.2472 8.24175 2.6572 6.39707 3.1273C4.5524 3.5974 3.11967 5.05027 2.67542 6.90135C2.29705 8.51252 2.72197 10.2072 3.81577 11.4492C3.9336 11.4148 4.04947 11.3818 4.17797 11.3401C5.6688 10.828 7.09637 10.1476 8.433 9.31202Z" fill="white"/>
<path d="M15.1293 3.4817C14.642 2.68072 13.4114 2.49601 11.5763 2.94497C11.005 3.08947 10.443 3.2684 9.89338 3.48072C10.2476 3.65355 10.581 3.86632 10.8868 4.11492C11.1991 4.01212 11.5055 3.92097 11.7974 3.84872C12.2856 3.71947 12.7873 3.64835 13.2922 3.63685C13.8929 3.63685 14.2245 3.78522 14.3351 3.96607C14.5164 4.2628 14.3496 5.0463 13.283 6.2788C13.0934 6.49795 12.8796 6.72 12.6556 6.94352C11.4856 8.07417 10.1902 9.06745 8.7947 9.904C7.41253 10.7693 5.93533 11.4726 4.39228 12C2.5358 12.6046 1.26791 12.5925 0.984278 12.1285C0.70064 11.6645 1.26791 10.5285 2.6541 9.152C2.56913 8.76032 2.53088 8.35995 2.54015 7.95927C0.334095 9.95297 -0.380087 11.6815 0.190096 12.6138C0.488763 13.1021 1.14088 13.3794 2.09361 13.3794C3.2267 13.3317 4.3426 13.0856 5.39058 12.6521C6.74535 12.1233 8.04808 11.4699 9.28198 10.7001C10.5269 9.94677 11.699 9.0792 12.7831 8.10862C13.2088 7.72667 13.6114 7.31982 13.9889 6.8902C15.2238 5.45987 15.619 4.2817 15.1293 3.4817Z" fill="white"/>
<path d="M1.92584 4.68122C1.88418 4.68135 1.84417 4.66492 1.81462 4.63555C1.78507 4.60617 1.7684 4.56627 1.76827 4.5246C1.76506 3.53697 0.962946 2.73832 -0.0247012 2.7394C-0.0826423 2.74262 -0.137618 2.71355 -0.167561 2.66385C-0.197503 2.61412 -0.197503 2.55195 -0.167561 2.50222C-0.137618 2.45252 -0.0826423 2.42344 -0.0247012 2.42667C0.963056 2.42801 1.76533 1.62921 1.76827 0.641457C1.76827 0.554162 1.83903 0.483395 1.92633 0.483395C2.01362 0.483395 2.08439 0.554162 2.08439 0.641457C2.0876 1.62948 2.89031 2.42828 3.87834 2.42667C3.96481 2.42667 4.03494 2.49678 4.03494 2.58327C4.03494 2.66977 3.96481 2.73987 3.87834 2.73987C2.89031 2.73827 2.0876 3.53707 2.08439 4.5251C2.08413 4.56685 2.06727 4.60677 2.03752 4.63607C2.00778 4.66535 1.96759 4.6816 1.92584 4.68122Z" fill="white"/>
<path d="M12.9813 14.751C12.9296 14.751 12.8875 14.7092 12.8873 14.6575C12.8849 14.0673 12.4055 13.5902 11.8153 13.5908C11.7636 13.5908 11.7217 13.5489 11.7217 13.4972C11.7217 13.4455 11.7636 13.4036 11.8153 13.4036C12.4055 13.4042 12.8849 12.9272 12.8873 12.337C12.8873 12.285 12.9294 12.2429 12.9813 12.2429C13.0333 12.2429 13.0754 12.285 13.0754 12.337C13.0778 12.9272 13.5572 13.4042 14.1474 13.4036C14.1991 13.4036 14.241 13.4455 14.241 13.4972C14.241 13.5489 14.1991 13.5908 14.1474 13.5908C13.5572 13.5902 13.0778 14.0673 13.0754 14.6575C13.0754 14.6824 13.0655 14.7062 13.0478 14.7238C13.0302 14.7414 13.0062 14.7512 12.9813 14.751Z" fill="white"/>
<path opacity="0.93" d="M5.39249 12.6482C6.97109 13.4359 8.84442 13.3531 10.3474 12.4292C11.8503 11.5054 12.7701 9.8713 12.7801 8.10712C11.6963 9.07732 10.5245 9.94457 9.27999 10.6977C8.04727 11.4666 6.74584 12.1196 5.39249 12.6482Z" fill="white"/>
<path opacity="0.93" d="M8.433 9.31202C9.7825 8.50402 11.0351 7.54424 12.1663 6.45139C12.2589 6.35929 12.3414 6.27492 12.4194 6.19395C12.1976 5.63 11.8764 5.11042 11.4711 4.6599C10.1951 3.2472 8.24175 2.6572 6.39707 3.1273C4.5524 3.5974 3.11967 5.05027 2.67542 6.90135C2.29705 8.51252 2.72197 10.2072 3.81577 11.4492C3.9336 11.4148 4.04947 11.3818 4.17797 11.3401C5.6688 10.828 7.09637 10.1476 8.433 9.31202Z" fill="white"/>
<path d="M15.1293 3.4817C14.642 2.68072 13.4114 2.49601 11.5763 2.94497C11.005 3.08947 10.443 3.2684 9.89338 3.48072C10.2476 3.65355 10.581 3.86632 10.8868 4.11492C11.1991 4.01212 11.5055 3.92097 11.7974 3.84872C12.2856 3.71947 12.7873 3.64835 13.2922 3.63685C13.8929 3.63685 14.2245 3.78522 14.3351 3.96607C14.5164 4.2628 14.3496 5.0463 13.283 6.2788C13.0934 6.49795 12.8796 6.72 12.6556 6.94352C11.4856 8.07417 10.1902 9.06745 8.7947 9.904C7.41253 10.7693 5.93533 11.4726 4.39228 12C2.5358 12.6046 1.26791 12.5925 0.984278 12.1285C0.70064 11.6645 1.26791 10.5285 2.6541 9.152C2.56913 8.76032 2.53088 8.35995 2.54015 7.95927C0.334095 9.95297 -0.380087 11.6815 0.190096 12.6138C0.488763 13.1021 1.14088 13.3794 2.09361 13.3794C3.2267 13.3317 4.3426 13.0856 5.39058 12.6521C6.74535 12.1233 8.04808 11.4699 9.28198 10.7001C10.5269 9.94677 11.699 9.0792 12.7831 8.10862C13.2088 7.72667 13.6114 7.31982 13.9889 6.8902C15.2238 5.45987 15.619 4.2817 15.1293 3.4817Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_725:32860">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -0,0 +1,19 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_724:59228)">
<path d="M1.92584 4.68122C1.88418 4.68135 1.84417 4.66492 1.81462 4.63555C1.78507 4.60617 1.7684 4.56627 1.76827 4.5246C1.76506 3.53697 0.962946 2.73832 -0.0247012 2.7394C-0.0826423 2.74262 -0.137618 2.71355 -0.167561 2.66385C-0.197503 2.61412 -0.197503 2.55195 -0.167561 2.50222C-0.137618 2.45252 -0.0826423 2.42344 -0.0247012 2.42667C0.963056 2.42801 1.76533 1.62921 1.76827 0.641457C1.76827 0.554162 1.83903 0.483395 1.92633 0.483395C2.01362 0.483395 2.08439 0.554162 2.08439 0.641457C2.0876 1.62948 2.89031 2.42828 3.87834 2.42667C3.96481 2.42667 4.03494 2.49678 4.03494 2.58327C4.03494 2.66977 3.96481 2.73987 3.87834 2.73987C2.89031 2.73827 2.0876 3.53707 2.08439 4.5251C2.08413 4.56685 2.06727 4.60677 2.03752 4.63607C2.00778 4.66535 1.96759 4.6816 1.92584 4.68122Z" fill="#212121"/>
<path d="M12.9813 14.751C12.9296 14.751 12.8875 14.7092 12.8873 14.6575C12.8849 14.0673 12.4055 13.5902 11.8153 13.5908C11.7636 13.5908 11.7217 13.5489 11.7217 13.4972C11.7217 13.4455 11.7636 13.4036 11.8153 13.4036C12.4055 13.4042 12.8849 12.9272 12.8873 12.337C12.8873 12.285 12.9294 12.2429 12.9813 12.2429C13.0333 12.2429 13.0754 12.285 13.0754 12.337C13.0778 12.9272 13.5572 13.4042 14.1474 13.4036C14.1991 13.4036 14.241 13.4455 14.241 13.4972C14.241 13.5489 14.1991 13.5908 14.1474 13.5908C13.5572 13.5902 13.0778 14.0673 13.0754 14.6575C13.0754 14.6824 13.0655 14.7062 13.0478 14.7238C13.0302 14.7414 13.0062 14.7512 12.9813 14.751Z" fill="#212121"/>
<path d="M5.39249 12.6482C6.97109 13.4359 8.84442 13.3531 10.3474 12.4292C11.8503 11.5054 12.7701 9.8713 12.7801 8.10712C11.6963 9.07732 10.5245 9.94457 9.27999 10.6977C8.04727 11.4666 6.74584 12.1196 5.39249 12.6482Z" fill="#212121"/>
<path d="M8.433 9.31202C9.7825 8.50402 11.0351 7.54424 12.1663 6.45139C12.2589 6.35929 12.3414 6.27492 12.4194 6.19395C12.1976 5.63 11.8764 5.11042 11.4711 4.6599C10.1951 3.2472 8.24175 2.6572 6.39708 3.1273C4.5524 3.5974 3.11968 5.05027 2.67543 6.90135C2.29705 8.51252 2.72198 10.2072 3.81578 11.4492C3.9336 11.4148 4.04948 11.3818 4.17798 11.3401C5.6688 10.828 7.09637 10.1476 8.433 9.31202Z" fill="#212121"/>
<path d="M15.1293 3.4817C14.642 2.68072 13.4114 2.49601 11.5763 2.94497C11.005 3.08947 10.443 3.2684 9.89338 3.48072C10.2476 3.65355 10.581 3.86632 10.8868 4.11492C11.1991 4.01212 11.5055 3.92097 11.7974 3.84872C12.2856 3.71947 12.7873 3.64835 13.2922 3.63685C13.8929 3.63685 14.2245 3.78522 14.3351 3.96607C14.5164 4.2628 14.3496 5.0463 13.283 6.2788C13.0934 6.49795 12.8796 6.72 12.6556 6.94352C11.4856 8.07417 10.1902 9.06745 8.7947 9.904C7.41253 10.7693 5.93533 11.4726 4.39228 12C2.5358 12.6046 1.26791 12.5925 0.98428 12.1285C0.700642 11.6645 1.26791 10.5285 2.6541 9.152C2.56913 8.76032 2.53088 8.35995 2.54015 7.95927C0.334097 9.95297 -0.380085 11.6815 0.190098 12.6138C0.488765 13.1021 1.14088 13.3794 2.09361 13.3794C3.2267 13.3317 4.3426 13.0856 5.39058 12.6521C6.74535 12.1233 8.04808 11.4699 9.28198 10.7001C10.5269 9.94677 11.699 9.0792 12.7831 8.10862C13.2088 7.72667 13.6114 7.31982 13.9889 6.8902C15.2238 5.45987 15.619 4.2817 15.1293 3.4817Z" fill="#212121"/>
<path d="M1.92584 4.68122C1.88418 4.68135 1.84417 4.66492 1.81462 4.63555C1.78507 4.60617 1.7684 4.56627 1.76827 4.5246C1.76506 3.53697 0.962946 2.73832 -0.0247012 2.7394C-0.0826423 2.74262 -0.137618 2.71355 -0.167561 2.66385C-0.197503 2.61412 -0.197503 2.55195 -0.167561 2.50222C-0.137618 2.45252 -0.0826423 2.42344 -0.0247012 2.42667C0.963056 2.42801 1.76533 1.62921 1.76827 0.641457C1.76827 0.554162 1.83903 0.483395 1.92633 0.483395C2.01362 0.483395 2.08439 0.554162 2.08439 0.641457C2.0876 1.62948 2.89031 2.42828 3.87834 2.42667C3.96481 2.42667 4.03494 2.49678 4.03494 2.58327C4.03494 2.66977 3.96481 2.73987 3.87834 2.73987C2.89031 2.73827 2.0876 3.53707 2.08439 4.5251C2.08413 4.56685 2.06727 4.60677 2.03752 4.63607C2.00778 4.66535 1.96759 4.6816 1.92584 4.68122Z" fill="#212121"/>
<path d="M12.9813 14.751C12.9296 14.751 12.8875 14.7092 12.8873 14.6575C12.8849 14.0673 12.4055 13.5902 11.8153 13.5908C11.7636 13.5908 11.7217 13.5489 11.7217 13.4972C11.7217 13.4455 11.7636 13.4036 11.8153 13.4036C12.4055 13.4042 12.8849 12.9272 12.8873 12.337C12.8873 12.285 12.9294 12.2429 12.9813 12.2429C13.0333 12.2429 13.0754 12.285 13.0754 12.337C13.0778 12.9272 13.5572 13.4042 14.1474 13.4036C14.1991 13.4036 14.241 13.4455 14.241 13.4972C14.241 13.5489 14.1991 13.5908 14.1474 13.5908C13.5572 13.5902 13.0778 14.0673 13.0754 14.6575C13.0754 14.6824 13.0655 14.7062 13.0478 14.7238C13.0302 14.7414 13.0062 14.7512 12.9813 14.751Z" fill="#212121"/>
<path opacity="0.93" d="M5.39249 12.6482C6.97109 13.4359 8.84442 13.3531 10.3474 12.4292C11.8503 11.5054 12.7701 9.8713 12.7801 8.10712C11.6963 9.07732 10.5245 9.94457 9.27999 10.6977C8.04727 11.4666 6.74584 12.1196 5.39249 12.6482Z" fill="#212121"/>
<path opacity="0.93" d="M8.433 9.31202C9.7825 8.50402 11.0351 7.54424 12.1663 6.45139C12.2589 6.35929 12.3414 6.27492 12.4194 6.19395C12.1976 5.63 11.8764 5.11042 11.4711 4.6599C10.1951 3.2472 8.24175 2.6572 6.39708 3.1273C4.5524 3.5974 3.11968 5.05027 2.67543 6.90135C2.29705 8.51252 2.72198 10.2072 3.81578 11.4492C3.9336 11.4148 4.04948 11.3818 4.17798 11.3401C5.6688 10.828 7.09637 10.1476 8.433 9.31202Z" fill="#212121"/>
<path d="M15.1293 3.4817C14.642 2.68072 13.4114 2.49601 11.5763 2.94497C11.005 3.08947 10.443 3.2684 9.89338 3.48072C10.2476 3.65355 10.581 3.86632 10.8868 4.11492C11.1991 4.01212 11.5055 3.92097 11.7974 3.84872C12.2856 3.71947 12.7873 3.64835 13.2922 3.63685C13.8929 3.63685 14.2245 3.78522 14.3351 3.96607C14.5164 4.2628 14.3496 5.0463 13.283 6.2788C13.0934 6.49795 12.8796 6.72 12.6556 6.94352C11.4856 8.07417 10.1902 9.06745 8.7947 9.904C7.41253 10.7693 5.93533 11.4726 4.39228 12C2.5358 12.6046 1.26791 12.5925 0.98428 12.1285C0.700642 11.6645 1.26791 10.5285 2.6541 9.152C2.56913 8.76032 2.53088 8.35995 2.54015 7.95927C0.334097 9.95297 -0.380085 11.6815 0.190098 12.6138C0.488765 13.1021 1.14088 13.3794 2.09361 13.3794C3.2267 13.3317 4.3426 13.0856 5.39058 12.6521C6.74535 12.1233 8.04808 11.4699 9.28198 10.7001C10.5269 9.94677 11.699 9.0792 12.7831 8.10862C13.2088 7.72667 13.6114 7.31982 13.9889 6.8902C15.2238 5.45987 15.619 4.2817 15.1293 3.4817Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_724:59228">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -16,6 +16,7 @@ export enum AzureResourceItemType {
message = 'azure.resource.itemType.message',
azureMonitor = 'azure.resource.itemType.azureMonitor',
azureMonitorContainer = 'azure.resource.itemType.azureMonitorContainer',
cosmosDBMongoAccount = 'azure.resource.itemType.cosmosDBMongoAccount'
}
export enum AzureResourceServiceNames {

View File

@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionContext } from 'vscode';
import { azureResource } from 'azurecore';
import { IAzureResourceService } from '../../../interfaces';
import { CosmosDbMongoTreeDataProvider } from './cosmosDbMongoTreeDataProvider';
export class CosmosDbMongoProvider implements azureResource.IAzureResourceProvider {
public constructor(
private _databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
private _extensionContext: ExtensionContext
) {
}
public getTreeDataProvider(): azureResource.IAzureResourceTreeDataProvider {
return new CosmosDbMongoTreeDataProvider(this._databaseServerService, this._extensionContext);
}
public get providerId(): string {
return 'azure.resource.providers.cosmosDbMongo';
}
}

View File

@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ResourceServiceBase, GraphData } from '../../resourceTreeDataProviderBase';
import { azureResource } from 'azurecore';
interface DbServerGraphData extends GraphData {
properties: {
fullyQualifiedDomainName: string;
administratorLogin: string;
};
}
const serversQuery = `where type == "${azureResource.AzureResourceType.cosmosDbAccount}" and kind == "MongoDB"`;
export class CosmosDbMongoService extends ResourceServiceBase<DbServerGraphData, azureResource.AzureResourceDatabaseServer> {
protected get query(): string {
return serversQuery;
}
protected convertResource(resource: DbServerGraphData): azureResource.AzureResourceDatabaseServer {
return {
id: resource.id,
name: resource.name,
fullName: resource.properties.fullyQualifiedDomainName,
loginName: resource.properties.administratorLogin,
defaultDatabaseName: '',
tenant: resource.tenantId,
subscription: {
id: resource.subscriptionId,
name: resource.subscriptionName
}
};
}
}

View File

@@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../../constants';
import { generateGuid } from '../../../utils';
import { IAzureResourceService } from '../../../interfaces';
import { ResourceTreeDataProviderBase } from '../../resourceTreeDataProviderBase';
import { azureResource } from 'azurecore';
import * as azdata from 'azdata';
export class CosmosDbMongoTreeDataProvider extends ResourceTreeDataProviderBase<azureResource.AzureResourceDatabaseServer> {
private static readonly COSMOSDG_MONGO_PROVIDER_ID = 'COSMOSDB_MONGO';
private static readonly CONTAINER_ID = 'azure.resource.providers.databaseServer.treeDataProvider.cosmosDbMongoContainer';
private static readonly CONTAINER_LABEL = localize('azure.resource.providers.databaseServer.treeDataProvider.cosmosDbMongoContainerLabel', "CosmosDB for Mongo");
public constructor(
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
private _extensionContext: ExtensionContext
) {
super(databaseServerService);
}
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: azdata.Account): azdata.TreeItem {
return {
id: `Cosmosdb_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: `${databaseServer.name} (CosmosDB Mongo API)`,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/cosmosdb_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/cosmosdb.svg')
},
collapsibleState: TreeItemCollapsibleState.None,
contextValue: AzureResourceItemType.cosmosDBMongoAccount,
payload: {
id: generateGuid(),
connectionName: databaseServer.name,
serverName: databaseServer.name,
userName: databaseServer.loginName,
password: '',
authenticationType: 'AzureMFA',
savePassword: true,
groupFullName: '',
groupId: '',
providerName: CosmosDbMongoTreeDataProvider.COSMOSDG_MONGO_PROVIDER_ID,
saveProfile: false,
options: {},
azureAccount: account.key.accountId,
azureTenantId: databaseServer.tenant,
azureResourceId: databaseServer.id,
azurePortalEndpoint: account.properties.providerSettings.settings.portalEndpoint
},
childProvider: CosmosDbMongoTreeDataProvider.COSMOSDG_MONGO_PROVIDER_ID,
type: azdata.ExtensionNodeType.Server
};
}
protected createContainerNode(): azureResource.IAzureResourceNode {
return {
account: undefined,
subscription: undefined,
tenantId: undefined,
treeItem: {
id: CosmosDbMongoTreeDataProvider.CONTAINER_ID,
label: CosmosDbMongoTreeDataProvider.CONTAINER_LABEL,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
},
collapsibleState: TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServerContainer
}
};
}
}

View File

@@ -345,7 +345,8 @@ declare module 'azurecore' {
postgresServer = 'microsoft.dbforpostgresql/servers',
azureArcService = 'microsoft.azuredata/datacontrollers',
storageAccount = 'microsoft.storage/storageaccounts',
logAnalytics = 'microsoft.operationalinsights/workspaces'
logAnalytics = 'microsoft.operationalinsights/workspaces',
cosmosDbAccount = 'microsoft.documentdb/databaseaccounts'
}
export interface IAzureResourceProvider extends azdata.DataProvider {

View File

@@ -37,6 +37,8 @@ import { SqlInstanceArcProvider } from './azureResource/providers/sqlinstanceArc
import { SqlInstanceArcResourceService } from './azureResource/providers/sqlinstanceArc/sqlInstanceArcService';
import { PostgresServerArcProvider } from './azureResource/providers/postgresArcServer/postgresServerProvider';
import { PostgresServerArcService } from './azureResource/providers/postgresArcServer/postgresServerService';
import { CosmosDbMongoProvider } from './azureResource/providers/cosmosdb/mongo/cosmosDbMongoProvider';
import { CosmosDbMongoService } from './azureResource/providers/cosmosdb/mongo/cosmosDbMongoService';
import * as azurecore from 'azurecore';
import * as azureResourceUtils from './azureResource/utils';
import * as utils from './utils';
@@ -134,6 +136,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
new AzureResourceDatabaseProvider(new AzureResourceDatabaseService(), extensionContext),
new SqlInstanceProvider(new SqlInstanceResourceService(), extensionContext),
new PostgresServerProvider(new PostgresServerService(), extensionContext),
new CosmosDbMongoProvider(new CosmosDbMongoService(), extensionContext)
];
if (arcFeaturedEnabled) {
providers.push(

View File

@@ -27,7 +27,8 @@ export const clientCapabilities = {
export const ConnectionProviderAndExtensionMap = new Map<string, string>([
['PGSQL', 'microsoft.azuredatastudio-postgresql'],
['KUSTO', 'microsoft.kusto'],
['LOGANALYTICS', 'microsoft.azuremonitor']
['LOGANALYTICS', 'microsoft.azuremonitor'],
['COSMOSDB_MONGO', 'microsoft.azure-cosmosdb-ads-extension']
]);
/**