"""
@runtime python:3.10
@memoryLimit 512000000
@timeout 600
@param {SecureString} in_password
@outputType Properties
"""
import json
import ssl
from pyVim.connect import *
def handler(context, inputs):
jsonOut = json.dumps(inputs, separators = (",", ":"))
# print("Inputs were {0}".format(jsonOut))
context = ssl._create_unverified_context()
try:
# The information on the connection is exemplary from the HOL.
# The information are available at:
# Assembler > Infrastructure > Cloud Accounts
serviceInstance = Connect(
host = "vcsa-01a.corp.vmbeans.com",
port = 443,
user = "administrator@corp.vmbeans.com",
# pwd = "VMware1!",
pwd = inputs["in_password"],
sslContext = context
)
serviceInstanceContent = serviceInstance.RetrieveContent()
aboutInfo = serviceInstanceContent.about
print("Name:", aboutInfo.name)
print("Fullname:", aboutInfo.fullName)
print("Vendor:", aboutInfo.vendor)
print("Version:", aboutInfo.version)
print("Build:", aboutInfo.build)
print("OS:", aboutInfo.osType)
print("API Type:", aboutInfo.apiType)
print("API Version:", aboutInfo.apiVersion)
print("Unique Id:", aboutInfo.instanceUuid)
print("License Product Name", aboutInfo.licenseProductName)
print("License Product Version:", aboutInfo.licenseProductVersion)
Disconnect(serviceInstance)
except Exception as ex:
print(ex.msg)
outputs = {
"status": "done"
}
return outputs
|