vSphereExportApi.ps1
Class vSphereExportApi : ExportApi { # properties [string]$VsphereCwSecretId [string]$VsphereHost [int]$VspherePort [string]$VsphereSslCaCertificate [bool]$VsphereSslNoCheckHostname [string]$VsphereDataCenter [string]$VsphereDataStore [string]$VsphereResourcePool [string]$VsphereNetwork [string]$SourceDiskName # Default constructor vSphereExportApi([hashtable]$values, [string]$smb) : base ($values, $smb) { $this.CopyValues(@{ VsphereCwSecretId = @{ required = $True } VsphereHost = @{ required = $True } VspherePort = @{ required = $False default = 443 } VsphereSslCaCertificate = @{ required = $False default = $null } VsphereSslNoCheckHostname = @{ required = $False default = $null } VsphereDataCenter = @{ required = $True } VsphereDataStore = @{ required = $True } VsphereResourcePool = @{ required = $False default = "Resources" } VsphereNetwork = @{ required = $True } SourceDiskName = @{ required = $True } }, $values) } # POST ProcessImage [string]ExportImageJob([string]$resourceLocationId, [bool]$overwrite, [bool]$thinProvision) { $exportData = @{ platformCredentialId = $this.VsphereCwSecretId vCenterHost = $this.VsphereHost vCenterPort = [int]$this.VspherePort datacenter = $this.VsphereDataCenter datastore = $this.VsphereDataStore resourcePoolName = $this.VsphereResourcePool network = $this.VsphereNetwork sourceDiskName = $this.SourceDiskName } if ($this.VsphereSslCaCertificate) { $exportData['vCenterSslCaCertificate'] = $this.VsphereSslCaCertificate } if ($this.VsphereSslNoCheckHostname) { $exportData['vCenterSslNoCheckHostname'] = $this.VsphereSslNoCheckHostname } return ([ExportApi]$this).ExportImageJob($resourceLocationId, "vSphere", $exportData, $overwrite, $thinProvision) } } |