pizzle85
Expert
Expert

Blueprint Input Array of Object

How do you pass an input array of object as a property of a machine resource?

inputs:

  disks:

      type: array

      title: Disks

      items:

        type: object

        properties:

          tier:

            type: string

            title: Tier

            enum:

              - Gold

              - Silver

              - Bronze

          size:

            type: number

            title: Size GB

            minimum: 80

            maximum: 1000

resources:

  Cloud_vSphere_Machine_1:

    type: Cloud.vSphere.Machine

    properties:

      disks: '${input.disks}'

Errors out with: Cannot deserialize instance of `String` out of START_ARRAY token at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.vmware.admiral.compute.content.TemplateComputeDescription["disks"])

0 Kudos
4 Replies
seplus
Contributor
Contributor

Did you try with attachedDisks: ${input.disks}  instead of  Disks: ${input.disks}?

0 Kudos
pizzle85
Expert
Expert

That does not produce the error above but does not do anything to the VM and does not send the properties to vRO in the inputProperties properties set.

0 Kudos
pizzle85
Expert
Expert

I ended up modifying the resource property to be:

resources:

  Cloud_vSphere_Machine_1:

    type: Cloud.vSphere.Machine

    properties:

      disks: '${to_string(input.disks)}'

Then in vRO i just treat the inputProperties variable as a JSON string and parse it to grab my disk objects.

0 Kudos
seplus
Contributor
Contributor

with this you can add multiple disks with same size.

As per your requirement, you may need to grab the user input and write some vRO code same as day-2 operation( add disk)

0 Kudos