Hi,
I'm writing a script that would list the resources in maintenance mode.
Using the GetResources from ResourceManagerHelper will get a list of the available resources.
The SLNet call GetResourceMessage will show the resource in Maintenance.
Is there a method to list the resources in maintenance from the helper or should the SLNet be used?
Thanks in advance.
Hi Julio,
First of all, please do never use raw SLNet messages to deal with SRM objects. There are proper managers to use, like ResourceManagerHelper, ServiceManagerHelper, etc.
As for your question, check the code below:
var resourceManager = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
var filter = ResourceExposers.Mode.Equal((int)ResourceMode.Maintenance);
var resources = resourceManager.GetResources(filter);
foreach (var resource in resources)
{
engine.GenerateInformation("Resource: " + resource.Name);
}
Hey Julio, any chance that you could elaborate on what the actual purpose is of retrieving these resources, and in what specific context you will use this information?
In case of an SRM environment, I believe that the SrmManager.ResourceManager will allow you to retrieve all resources with the GetResources() call, where the Mode property of the resource will indicate the maintenance mode.
Then again, provisioning and correctly managing the resource availability in an SRM environment is a very important step, and does require the necessary attention. Therefore, I believe it could be useful to understand the full context. Networks are continuously under evolution nowadays and it is important to ensure that resource availability reflects any new or removed inventory, changed configurations, license files, firmware versions, etc...