Previous Topic: Create Custom Rules

Next Topic: Create the Reservation Service

Create Custom Actions

You can create a custom action for a rule to meet a need that the predefined actions and existing custom actions do not meet. For example, you create an action to run a command when a request from of a certain class changes the status from Pending Fulfillment to Fulfilled. For this scenario, for each custom rule that you created, you write a CA Process Automation process to call the web service named addResourceToRequestItem. The web service associates the fulfilled resource to reservation.

Note: For more information about creating custom actions, including parameter values, see the Administration Guide.

Follow these steps:

  1. Complete the following steps for each custom rule that you created. The custom rules are as follows:
  2. (CA Process Automation) Create a CA Process Automation process and Start Request Form to call the CA Service Catalog web service named addResourceToRequestItem. The syntax follows:
    addResourceToRequestItem(String sessionId, int requestItemId, RequestResourceItem resourceItem) 
    
    sessionId

    Specifies the security handle for calling web services.

    requestItemId

    Specifies the request item ID or subscription detail Id.

    RequestResourceItem

    Specifies the request resource item to associate.

    The following parameters apply:

    Id – Identifies the request resource ID. It is an automatically generated UUID.

    parentId – Specifies the request resource ID of the parent resource.

    (Required) resourceTypeId – Specifies the resource type id, for example, the UUID of a resource named Computer.

    status – Specifies the status of the request resource. Valid values are as follows: CREATED(100), READY(200), CANCELLED(300), and COMPLETED(400)

    (Required) requestItemId – Specifies the request item ID or subscription detail ID.

    createdDate – Specifies the date when the requested resource was created.

    resourceId – Specifies the resource Id, for example, vm1234 or memory1234.

    resourceName – Specifies the description of the resource, for example, virtual machines 1234.

    resourceUrl – Specifies the URL to the external reservation system, for example, http://www.ca.com:8080/xyz/.

    resourceItem

    Specifies the request resource item to associate.

    This call returns the following with updated details: com.ca.usm.soap.axisInterfaces.RequestResourceItem.

    Note: For more information about creating CA Process Automation processes and Start Request Forms, see the CA Process Automation documentation. For more information about web services, see the Administration Guide and the Web Services API Documentation.

  3. (CA Service Catalog) Edit and create a custom action for the rule. For example, for the rule named Add Resource Item - Computer, create a custom action named Add Virtual Machine.

    The Rule Details page appears.

  4. Select CA IT PAM as the Type. This type links the action to a CA Process Automation process.
  5. Select the appropriate Start Request Form for the CA Process Automation process, for example, Demo_AddResourceToRequestItemSRF.
  6. Complete the parameters for the new action.
  7. Click OK.

    The Catalog system saves your changes.

You have created the custom actions for the custom rules.

Example for Reserving a Disk

The following example is a web service call for reserving a disk, so that you can add the disk to an existing reservation.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.soap.usm.ca.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:addResourceToRequestItem soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId xsi:type="xsd:string">dev_session</sessionId>
         <requestItemId xsi:type="xsd:int">10076</requestItemId>
         <resourceItem xsi:type="urn:RequestResourceItem" xmlns:urn="urn:usmRequestService">
            <parentId xsi:type="xsd:string">a42b178f5c68-1251880b131bfbcf114-7f511313189039046</parentId>
            <resourceId xsi:type="xsd:string">vm10466-disk1</resourceId>
            <resourceName xsi:type="xsd:string">vm10466-disk1</resourceName>
            <resourceTypeId xsi:type="xsd:string">662d774349a0-54f958451317186e4a5-7ff51311871145702</resourceTypeId>
            <resourceUrl xsi:type="xsd:string">https://cat-dev-en2k8-3:8443/ssrm/</resourceUrl>
            <status xsi:type="xsd:string">100</status>
         </resourceItem>
      </ser:addResourceToRequestItem>
   </soapenv:Body>
</soapenv:Envelope>

Example for Reserving Memory

The following example is a web service call for reserving memory, so that you can add the memory to an existing reservation.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.soap.usm.ca.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:addResourceToRequestItem soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId xsi:type="xsd:string">dev_session</sessionId>
         <requestItemId xsi:type="xsd:int">10469</requestItemId>
         <resourceItem xsi:type="urn:RequestResourceItem" xmlns:urn="urn:usmRequestService">
            <parentId xsi:type="xsd:string">a42b178f5c68-1251880b131bfbcf114-7f511313189039046</parentId>
            <resourceId xsi:type="xsd:string">vm10466-memory1</resourceId>
            <resourceName xsi:type="xsd:string">vm10466-memory1</resourceName>
            <resourceTypeId xsi:type="xsd:string">662d774349a0-54f958451317186e4a5-7ff61311871100123</resourceTypeId>
            <resourceUrl xsi:type="xsd:string">https://cat-dev-en2k8-3:8443/ssrm/</resourceUrl>
            <status xsi:type="xsd:string">100</status>
         </resourceItem>
      </ser:addResourceToRequestItem>
   </soapenv:Body>
</soapenv:Envelope>