Skip to content

Commit

Permalink
Merge branch 'master' into fix-adls
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddie Clayton authored Jan 11, 2019
2 parents 501d667 + dcb0189 commit 5b8ef2a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
42 changes: 33 additions & 9 deletions src/ScenarioTest.ResourceManager/AzureRM.Resources.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function Get-AzureRmResourceGroup
{
[CmdletBinding()]
[Alias("Get-AzResourceGroup")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
Expand All @@ -11,11 +12,10 @@
$client = Get-ResourcesClient $context
}
PROCESS {
if($Name -eq $null) {
if([string]::IsNullOrEmpty($Name)) {
$getTask = $client.ResourceGroups.ListWithHttpMessagesAsync($null, $null, [System.Threading.CancellationToken]::None)
$rg = $getTask.Result
$resourceGroup = List-ResourceGroup
Write-Output $resourceGroup
$rg = $getTask.Result.Body
Write-Output $rg
} else {
$getTask = $client.ResourceGroups.GetWithHttpMessagesAsync($Name, $null, [System.Threading.CancellationToken]::None)
$rg = $getTask.Result
Expand All @@ -30,9 +30,33 @@
END {}
}

function Get-AzureRmResource
{
[CmdletBinding()]
[Alias("Get-AzResource")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceType)
BEGIN {
$context = Get-Context
$client = Get-ResourcesClient $context
}
PROCESS {
$result = $client.Resources.ListWithHttpMessagesAsync().Result.Body
if (![string]::IsNullOrEmpty($ResourceType)) {
$result = $result | Where-Object { $_.Type -eq $ResourceType }
Write-Output $result
}
else {
Write-Output $result
}
}
END {}
}

function Get-AzureRmResourceProvider
{
[CmdletBinding()]
[Alias("Get-AzResourceProvider")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ProviderNamespace)
BEGIN {
Expand All @@ -49,6 +73,7 @@ function Get-AzureRmResourceProvider
function New-AzureRmResourceGroup
{
[CmdletBinding()]
[Alias("New-AzResourceGroup")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
Expand All @@ -72,6 +97,7 @@ function New-AzureRmResourceGroup
function New-AzureRmResourceGroupDeployment
{
[CmdletBinding()]
[Alias("New-AzResourceGroupDeployment")]
param(
[string] [alias("DeploymentName")] $Name,
[string] $ResourceGroupName,
Expand Down Expand Up @@ -118,6 +144,7 @@ function New-AzureRmResourceGroupDeployment
function Remove-AzureRmResourceGroup
{
[CmdletBinding()]
[Alias("Remove-AzResourceGroup")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
[switch] $Force)
Expand All @@ -135,6 +162,7 @@ function Remove-AzureRmResourceGroup
function New-AzureRmRoleAssignmentWithId
{
[CmdletBinding()]
[Alias("New-AzRoleAssignmentWithId")]
param(
[Guid] [Parameter()] [alias("Id", "PrincipalId")] $ObjectId,
[string] [Parameter()] [alias("Email", "UserPrincipalName")] $SignInName,
Expand Down Expand Up @@ -221,6 +249,7 @@ function New-AzureRmRoleAssignmentWithId
function New-AzureRmRoleDefinitionWithId
{
[CmdletBinding()]
[Alias("New-AzRoleDefinitionWithId")]
param(
[Microsoft.Azure.Commands.Resources.Models.Authorization.PSRoleDefinition] [Parameter()] $Role,
[string] [Parameter()] $InputFile,
Expand Down Expand Up @@ -273,8 +302,3 @@ function Get-ResourceGroup {
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; "ResourceId" = $id}
return $rg
}

function List-ResourceGroup {
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; }
return $rg
}
7 changes: 5 additions & 2 deletions src/ScenarioTest.ResourceManager/AzureRM.Storage.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

function Get-AzureRmStorageAccount
{

[CmdletBinding()]
[Alias("Get-AzStorageAccount")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
Expand Down Expand Up @@ -36,6 +36,7 @@ function Get-AzureRmStorageAccount
function New-AzureRmStorageAccount
{
[CmdletBinding()]
[Alias("New-AzStorageAccount")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)][alias("StorageAccountName")] $Name,
Expand Down Expand Up @@ -92,6 +93,7 @@ function New-AzureRmStorageAccount
function Set-AzureRmStorageAccount
{
[CmdletBinding()]
[Alias("Set-AzStorageAccount")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)][alias("StorageAccountName")] $Name,
Expand Down Expand Up @@ -123,6 +125,7 @@ function Set-AzureRmStorageAccount
function Get-AzureRmStorageAccountKey
{
[CmdletBinding()]
[Alias("Get-AzStorageAccountKey")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
Expand Down Expand Up @@ -155,8 +158,8 @@ function Get-AzureRmStorageAccountKey

function Remove-AzureRmStorageAccount
{

[CmdletBinding()]
[Alias("Remove-AzStorageAccount")]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
Expand Down

0 comments on commit 5b8ef2a

Please sign in to comment.