Skip to content

Commit 3ab36e9

Browse files
committed
Add resource provider to resources.ps1
1 parent 386112a commit 3ab36e9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/AzureRM.Resources.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@
2727

2828
}
2929

30+
function Get-AzureRmResourceProvider
31+
{
32+
[CmdletBinding()]
33+
param(
34+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ProviderNamespace)
35+
BEGIN {
36+
$context = Get-Context
37+
$client = Get-ResourcesClient $context
38+
}
39+
PROCESS {
40+
$getTask = $client.Providers.GetAsync($ProviderNamespace, [System.Threading.CancellationToken]::None)
41+
$pr = $getTask.Result
42+
$provider = Get-Provider $ProviderNamespace
43+
Write-Output $provider
44+
}
45+
END {}
46+
47+
}
48+
3049
function New-AzureRmResourceGroup
3150
{
3251
[CmdletBinding()]
@@ -124,6 +143,15 @@ function Get-ResourceGroup {
124143
return $rg
125144
}
126145

146+
function Get-Provider {
147+
param([string] $name)
148+
$rtype = New-Object PSObject -Property @{"ResourceTypeName" = New-Object System.Collections.ArrayList; "Locations" = @("West US");
149+
"ApiVersions" = @("2015-01-01"); }
150+
$pr = New-Object PSObject -Property @{"ProviderNamespace" = $name; "RegistrationState" = "Registered"; "Locations" = @("West US");
151+
"ResourceTypes" = $rtype;}
152+
return $pr
153+
}
154+
127155
function List-ResourceGroup {
128156
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; }
129157
return $rg

0 commit comments

Comments
 (0)