Added Set-VMCSDDC function to rename SDDC
This commit is contained in:
@@ -918,23 +918,23 @@ Function Get-VMCPublicIP {
|
||||
.EXAMPLE
|
||||
Get-VMCPublicIP -OrgName $OrgName -SDDCName $SDDCName
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName
|
||||
)
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName
|
||||
)
|
||||
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
$publicIPs = $publicIPService.list($orgId,$sddcId)
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
$publicIPs = $publicIPService.list($orgId,$sddcId)
|
||||
|
||||
$publicIPs | select public_ip, name, allocation_id
|
||||
}
|
||||
$publicIPs | select public_ip, name, allocation_id
|
||||
}
|
||||
}
|
||||
|
||||
Function New-VMCPublicIP {
|
||||
Function New-VMCPublicIP {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
@@ -952,28 +952,28 @@ Function Get-VMCPublicIP {
|
||||
.EXAMPLE
|
||||
New-VMCPublicIP -OrgName $OrgName -SDDCName $SDDCName -Description "Test for Randy"
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName,
|
||||
[Parameter(Mandatory=$False)]$Description
|
||||
)
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName,
|
||||
[Parameter(Mandatory=$False)]$Description
|
||||
)
|
||||
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
|
||||
$publicIPSpec = $publicIPService.Help.create.spec.Create()
|
||||
$publicIPSpec.count = 1
|
||||
$publicIPSpec.names = @($Description)
|
||||
$publicIPSpec = $publicIPService.Help.create.spec.Create()
|
||||
$publicIPSpec.count = 1
|
||||
$publicIPSpec.names = @($Description)
|
||||
|
||||
Write-Host "Requesting a new public IP Address for your SDDC ..."
|
||||
$results = $publicIPService.create($orgId,$sddcId,$publicIPSpec)
|
||||
}
|
||||
Write-Host "Requesting a new public IP Address for your SDDC ..."
|
||||
$results = $publicIPService.create($orgId,$sddcId,$publicIPSpec)
|
||||
}
|
||||
}
|
||||
|
||||
Function Remove-VMCPublicIP {
|
||||
Function Remove-VMCPublicIP {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
@@ -991,21 +991,58 @@ Function Get-VMCPublicIP {
|
||||
.EXAMPLE
|
||||
Remove-VMCPublicIP -OrgName $OrgName -SDDCName $SDDCName -AllocationId "eipalloc-0567acf34e436c01f"
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName,
|
||||
[Parameter(Mandatory=$True)]$AllocationId
|
||||
)
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$SDDCName,
|
||||
[Parameter(Mandatory=$True)]$AllocationId
|
||||
)
|
||||
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$orgId = (Get-VMCOrg -Name $OrgName).Id
|
||||
$sddcId = (Get-VMCSDDC -Name $SDDCName -Org $OrgName).Id
|
||||
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
$publicIPService = Get-VmcService "com.vmware.vmc.orgs.sddcs.publicips"
|
||||
|
||||
Write-Host "Deleting public IP Address with ID $AllocationId ..."
|
||||
$results = $publicIPService.delete($orgId,$sddcId,$AllocationId)
|
||||
Write-Host "Deleting public IP Address with ID $AllocationId ..."
|
||||
$results = $publicIPService.delete($orgId,$sddcId,$AllocationId)
|
||||
}
|
||||
}
|
||||
|
||||
Function Set-VMCSDDC {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: William Lam
|
||||
Date: 01/12/2019
|
||||
Organization: VMware
|
||||
Blog: http://www.virtuallyghetto.com
|
||||
Twitter: @lamw
|
||||
===========================================================================
|
||||
|
||||
.SYNOPSIS
|
||||
Rename an SDDC
|
||||
.DESCRIPTION
|
||||
This cmdlet renames an SDDC
|
||||
.EXAMPLE
|
||||
Set-VMCSDDC -SDDC $SDDCName -OrgName $OrgName -Name $NewSDDCName
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]$SDDCName,
|
||||
[Parameter(Mandatory=$True)]$OrgName,
|
||||
[Parameter(Mandatory=$True)]$Name
|
||||
)
|
||||
|
||||
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use the Connect-VMC to connect" } Else {
|
||||
$sddc = Get-VMCSDDC -Org $OrgName -Name $SDDCName
|
||||
if($sddc) {
|
||||
$sddcService = Get-VmcService com.vmware.vmc.orgs.sddcs
|
||||
$renameSpec = $sddcService.help.patch.sddc_patch_request.Create()
|
||||
$renameSpec.name = $Name
|
||||
|
||||
Write-Host "`nRenaming SDDC `'$SDDCName`' to `'$Name`' ...`n"
|
||||
$results = $sddcService.patch($sddc.org_id,$sddc.id,$renameSpec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function 'Get-VMCCommand', 'Connect-VMCVIServer', 'Get-VMCOrg', 'Get-VMCSDDC', 'Get-VMCTask', 'Get-VMCSDDCDefaultCredential', 'Get-VMCSDDCPublicIP', 'Get-VMCVMHost', 'Get-VMCSDDCVersion', 'Get-VMCFirewallRule', 'Export-VMCFirewallRule', 'Import-VMCFirewallRule', 'Remove-VMCFirewallRule', 'Get-VMCLogicalNetwork', 'Remove-VMCLogicalNetwork', 'New-VMCLogicalNetwork', 'Get-VMCSDDCSummary', 'Get-VMCPublicIP', 'New-VMCPublicIP', 'Remove-VMCPublicIP'
|
||||
Export-ModuleMember -Function 'Get-VMCCommand', 'Connect-VMCVIServer', 'Get-VMCOrg', 'Get-VMCSDDC', 'Get-VMCTask', 'Get-VMCSDDCDefaultCredential', 'Get-VMCSDDCPublicIP', 'Get-VMCVMHost', 'Get-VMCSDDCVersion', 'Get-VMCFirewallRule', 'Export-VMCFirewallRule', 'Import-VMCFirewallRule', 'Remove-VMCFirewallRule', 'Get-VMCLogicalNetwork', 'Remove-VMCLogicalNetwork', 'New-VMCLogicalNetwork', 'Get-VMCSDDCSummary', 'Get-VMCPublicIP', 'New-VMCPublicIP', 'Remove-VMCPublicIP', 'Set-VMCSDDC'
|
||||
|
||||
Reference in New Issue
Block a user