UpdateResourceByMap
This method updates a resource detail on the effective date defined within the change set.
UpdateResourceByMap (ResourceName, ResourceDetails)
|
Name |
Type |
Description |
|
ResourceName |
string |
The name of the resource. |
|
ResourceDetails |
Map |
Map of resource details is in the structure of the map returned from GetResourceGroupDetails method (including returns ResourceTimeZone). The ResourceGroups, Resources, and Services internal maps can be empty. The ResourceGroupId entry is not relevant. The ResourceTypes entry must contain at least one resource type. The CustomAttributes internal map must contain all of the custom attributes that are attached to the resource. |
We recommend calling "Tools.UpdateResourceByMap" (or "Tools.UpdateResourceGroupByMap") instead of multiple calls to "Tools.UpdateResourcesCustomAttribute".
Option Explicit
Const CHANGESET_NAME = "Default"
'This script assumes that the following resource exists
Const RESOURCE_TEMPLATE_NAME = "ResourceTemplate"
Sub OnLoad()
'Tools.log "Integration Script: In OnLoad procedure", "I"
End Sub
Sub Main()
Dim resourceName
resourceName = "MyResource1"
Dim aMap
Set aMap = Tools.GetResourceDetails (RESOURCE_TEMPLATE_NAME, CHANGESET_NAME)
aMap("ResourceName") = resourceName
'aMap("ChangeSetName") = CHANGESET_NAME
aMap("CustomAttributes")("Owner")("CustomAttributeValue") = "Joe"
aMap("CustomAttributes")("SerialNumber")("CustomAttributeValue") = "123456"
If Not Tools.IsResourceExists(resourceName) Then
Tools.AddResourceByMap(aMap)
Else
Tools.UpdateResourceByMap resourceName, aMap
End If
'Tools.CommitResources resourceName
Tools.Commit
End Sub
Function Result
'Tools.log " Integration Script : In Result function", "I"
'Result =
End Function
| Copyright © 2012 CA. Tous droits réservés. | Envoyer un courriel à CA Technologies sur cette rubrique |