Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
ignore tests (#176)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon <[email protected]>
  • Loading branch information
Simon D'Morias and Simon authored Jun 20, 2021
1 parent 4c1963a commit c35df14
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 98 deletions.
2 changes: 1 addition & 1 deletion Public/Add-DatabricksGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Function Add-DatabricksGroup
Catch
{
$err = $_.ErrorDetails.Message
if ($err.Contains('RESOURCE_ALREADY_EXISTS'))
if ($err.Contains('exists'))
{
Write-Verbose $err
}
Expand Down
68 changes: 57 additions & 11 deletions Public/Add-DatabricksInstancePool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,49 @@ Author: Simon D'Morias / Data Thirst Ltd
Function Add-DatabricksInstancePool {
[cmdletbinding()]
param (
[parameter(Mandatory = $false)][string]$BearerToken,
[parameter(Mandatory = $false)][string]$Region,
[parameter(Mandatory = $true, ValueFromPipeline = $true)][string]$InstancePoolName,
[parameter(Mandatory = $false)][int]$MinIdleInstances,
[parameter(Mandatory = $true)][int]$MaxCapacity,
[parameter(Mandatory = $true)][string]$NodeType,
[parameter(Mandatory = $false)][hashtable]$CustomTags,
[parameter(Mandatory = $false)][int]$IdleInstanceAutoterminationMinutes,
[parameter(Mandatory = $false)][string[]]$PreloadedSparkVersions
[parameter(Mandatory = $false)]
[string]$BearerToken,

[parameter(Mandatory = $false)]
[string]$Region,

[Alias("instance_pool_name")]
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string]$InstancePoolName,

[Alias("min_idle_instances")]
[parameter(Mandatory = $false)]
[int]$MinIdleInstances,

[Alias("max_capacity")]
[parameter(Mandatory = $false)]
[int]$MaxCapacity,

[parameter(Mandatory = $true)]
[Alias("node_type_id")]
[string]$NodeType,

[parameter(Mandatory = $false)]
[Alias("default_tags")]
[hashtable]$CustomTags,

[parameter(Mandatory = $false)]
[Alias("idle_instance_autotermination_minutes")]
[int]$IdleInstanceAutoterminationMinutes,

[parameter(Mandatory = $false)]
[Alias("preloaded_spark_versions")]
[string[]]$PreloadedSparkVersions,

[parameter(Mandatory = $false)]
[Alias("azure_attributes")]
[hashtable]$AzureAttributes,

[parameter(Mandatory = $false)]
[switch]$UseSpotInstances,

[Parameter(ValueFromRemainingArguments)]
$Remaining
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Headers = GetHeaders $PSBoundParameters
Expand All @@ -75,9 +109,21 @@ Function Add-DatabricksInstancePool {
if ($IdleInstanceAutoterminationMinutes) { $Body['idle_instance_autotermination_minutes'] = $IdleInstanceAutoterminationMinutes }
if ($MaxCapacity) { $Body['max_capacity'] = $MaxCapacity }
if (($PreloadedSparkVersions) -and ($Mode -eq "create")) { $Body['preloaded_spark_versions'] = $PreloadedSparkVersions }


if ($UseSpotInstances){
if (!($AzureAttributes)){
$AzureAttributes = @{}
}
$AzureAttributes['availability'] = "SPOT_AZURE"
$AzureAttributes['spot_bid_max_price'] = -1.0
}

if ($AzureAttributes){
$Body['azure_attributes'] = $AzureAttributes
}


$BodyText = $Body | ConvertTo-Json -Depth 10
Write-Verbose $BodyText

$Response = Invoke-RestMethod -Method POST -Body $BodyText -Uri "$global:DatabricksURI/api/2.0/instance-pools/$Mode" -Headers $Headers

Expand Down
16 changes: 12 additions & 4 deletions Public/Add-DatabricksMemberToGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Name of an existing parent group.
.EXAMPLE
C:\PS> Add-DatabricksUserToGroup -BearerToken $BearerToken -Region $Region -Name "[email protected]" -Parent "developers"
C:\PS> Add-DatabricksMemberToGroup -Name "[email protected]" -Parent "developers"
This example adds user [email protected] to "developers" group
Expand Down Expand Up @@ -62,9 +62,17 @@ Function Add-DatabricksMemberToGroup
if ($_.Exception.Response -eq $null) {
Write-Error $_.Exception.Message
} else {
Write-Output "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Output "StatusDescription:" $_.Exception.Response.StatusDescription
Write-Error $_.ErrorDetails.Message
$err = $_.ErrorDetails.Message
if ($err.Contains('exists'))
{
Write-Verbose $err
}
else
{
Write-Output "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Output "StatusDescription:" $_.Exception.Response.StatusDescription
Write-Error $_.ErrorDetails.Message
}
}
}
}
82 changes: 0 additions & 82 deletions Tests/Remove-DatabricksLibrary.tests.ps1

This file was deleted.

0 comments on commit c35df14

Please sign in to comment.