Added Set-VMCSDDC function to rename SDDC

This commit is contained in:
William Lam
2019-01-12 15:56:50 -08:00
parent 24556bbe19
commit 59ab2785e3

View File

@@ -932,9 +932,9 @@ Function Get-VMCPublicIP {
$publicIPs | select public_ip, name, allocation_id $publicIPs | select public_ip, name, allocation_id
} }
} }
Function New-VMCPublicIP { Function New-VMCPublicIP {
<# <#
.NOTES .NOTES
=========================================================================== ===========================================================================
@@ -971,9 +971,9 @@ Function Get-VMCPublicIP {
Write-Host "Requesting a new public IP Address for your SDDC ..." Write-Host "Requesting a new public IP Address for your SDDC ..."
$results = $publicIPService.create($orgId,$sddcId,$publicIPSpec) $results = $publicIPService.create($orgId,$sddcId,$publicIPSpec)
} }
} }
Function Remove-VMCPublicIP { Function Remove-VMCPublicIP {
<# <#
.NOTES .NOTES
=========================================================================== ===========================================================================
@@ -1006,6 +1006,43 @@ Function Get-VMCPublicIP {
Write-Host "Deleting public IP Address with ID $AllocationId ..." Write-Host "Deleting public IP Address with ID $AllocationId ..."
$results = $publicIPService.delete($orgId,$sddcId,$AllocationId) $results = $publicIPService.delete($orgId,$sddcId,$AllocationId)
} }
} }
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' 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', 'Set-VMCSDDC'