Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

How to add an Array of VCACCAFEAlert into VCACCAFEAlertPolicy on vRO?

$
0
0

Hi all,

 

I'm stuck from now.

I created an array of VCACCAFEAlert that i must put on VCACCAFEAlertPolicy object on vRO in order to create vRA reservations from vRO with VCACCAFE plugin.

 

Here's the code:

 

//Set Alert Objects Array

var AlertsArray = new Array();

var myvCACCAFEAlert = new vCACCAFEAlert();

myvCACCAFEAlert.setReferenceResourceId("storage");

myvCACCAFEAlert.setAlertPercentLevel(100);

AlertsArray.push(myvCACCAFEAlert);

var myvCACCAFEAlert = new vCACCAFEAlert();

myvCACCAFEAlert.setReferenceResourceId("memory");

myvCACCAFEAlert.setAlertPercentLevel(100);

AlertsArray.push(myvCACCAFEAlert);

var myvCACCAFEAlert = new vCACCAFEAlert();

myvCACCAFEAlert.setReferenceResourceId("cpu");

myvCACCAFEAlert.setAlertPercentLevel(100);

AlertsArray.push(myvCACCAFEAlert);

var myvCACCAFEAlert = new vCACCAFEAlert();

myvCACCAFEAlert.setReferenceResourceId("machine");

myvCACCAFEAlert.setAlertPercentLevel(100);

AlertsArray.push(myvCACCAFEAlert);

 

//Set AlertPolicy Object

var myvCACCAFEAlertPolicy = new vCACCAFEAlertPolicy() ;

myvCACCAFEAlertPolicy.setEnabled(false);

myvCACCAFEAlertPolicy.setFrequencyReminder(0);

myvCACCAFEAlertPolicy.setEmailBgMgr(true);

 

The vCACCAFEAlertPolicy scripting class have .getAlerts() but I don't see .setAlerts(vCACCAFEAlert[]).

 

The expected JSON should be like that:

 

"name": "{{ reservation_name }}",

  "reservationTypeId": "Infrastructure.Reservation.Virtual.vSphere",

  "tenantId": "vsphere.local",

  "subTenantId": "{{ business_group_id }}",

  "enabled": true,

  "priority": 0,

  "reservationPolicyId": "{{ reservation_policy_id }}",

  "alertPolicy": {

    "enabled": false,

    "frequencyReminder": 0,

    "emailBgMgr": true,

    "recipients": [],

    "alerts": [

      {

        "alertPercentLevel": 100,

        "referenceResourceId": "storage"

      },

      {

        "alertPercentLevel": 100,

        "referenceResourceId": "memory"

      },

      {

        "alertPercentLevel": 100,

        "referenceResourceId": "cpu"

      },

      {

        "alertPercentLevel": 100,

        "referenceResourceId": "machine"

      }

    ]

  },

.....

 

 

I don't want to use a "Golden Reservation" just for that, for now this is the only element that is missing in order to create a reservation with all elements.

Thanks for your help.


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>