Hosting Handler

create()

Signature

public function create(ProductHosting $productHosting, array &$productOptionMapping): ServerHostingCreatedResponse

Description

Creation / installation of the hosting product. This should create the entire automation process for creating the product.

The $productOptionMapping parameter contains a key-value array consisting of your configured getAvailableProductOptions() which are either directly configured by the admin inside the product or configured/ordered by the customer via product options. (the data is always the same)

Return value

ServerHostingCreatedResponse for success, Exception with the mesage on error. Example:

return new ServerHostingCreatedResponse(
   true,    // if successfull, should always be true!
   [        // customFields where additional data is stored, e.g. the account id or passwords
      "proxmoxVmId" => $freeVmId,
      "proxmoxVirtualization" => $productOptionMapping['virtualization'],
      "proxmoxTemplate" => $proxmoxTemplate->templateData,
      "proxmoxTemplateId" => $proxmoxTemplate->id,
      "proxmoxRootPw" => $rootPassword,
   ],
   ProductHostingStatusEnum::ACTIVE // The new status of the hosting (optional) This can be usefull if the creation has been initiated and must be checked for success asynchron e.g. via scheduled command.
)
Was this helpful?