Skip to content

Commit

Permalink
Merge pull request #27 from alagoutte/org
Browse files Browse the repository at this point in the history
Organization(Configuration): Set and Remove Organization on VC
  • Loading branch information
alagoutte authored Jul 16, 2020
2 parents 7f2e7df + 7728980 commit 3e8d96a
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions PowerArubaIAP/Public/Configuration/organization.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# Copyright 2020, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
#

function Set-ArubaIAPOrganization {

<#
.SYNOPSIS
Set an organization to Aruba Instant AP
.DESCRIPTION
Set organization to Aruba Instant AP
.EXAMPLE
Set-ArubaIAPOrganization MyOrg
Set Organization MyOrg to IAP
#>

[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
Param(
[Parameter (Mandatory = $true, Position = 1)]
[string]$organization,
[Parameter (Mandatory = $false)]
[ipaddress]$iap_ip_addr = ${DefaultArubaIAPConnection}.iap_ip_addr
)

Begin {
}

Process {

$uri = "rest/organization"

$organization_info = @{
"action" = "create"
"organization" = $organization
}

$body = @{
"organization_info" = $organization_info
}

if ($PSCmdlet.ShouldProcess($iap_ip_addr, 'Set Organization')) {
$response = Invoke-ArubaIAPRestMethod -uri $uri -body $body -method 'POST'

$response
}
}

End {
}
}

function Remove-ArubaIAPOrganization {

<#
.SYNOPSIS
Remove organization to Aruba Instant AP
.DESCRIPTION
Remove organization to Aruba Instant AP
.EXAMPLE
Remove-ArubaIAPorganization
Remove Organization Server to IAP
.EXAMPLE
Remove-ArubaIAPOrganization -confirm:$false
Remove Organization Server to IAP without confirmation
#>

[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'high')]
Param(
[Parameter (Mandatory = $false)]
[ipaddress]$iap_ip_addr = ${DefaultArubaIAPConnection}.iap_ip_addr
)

Begin {
}

Process {

$uri = "rest/organization"

$organization_info = @{
"action" = "delete"
}

$body = @{
"organization_info" = $organization_info
}

if ($PSCmdlet.ShouldProcess($iap_ip_addr, 'Remove Organization')) {
$response = Invoke-ArubaIAPRestMethod -uri $uri -body $body -method 'POST'

$response
}
}

End {
}
}

0 comments on commit 3e8d96a

Please sign in to comment.