Assigning a Maintenance Policy

Use this API to associate/dissociate a maintenance Policy to a Component/Host/Test/Test For Host/Test For Component/Test For component type.

URL: http://<eG manager IP:port>/api/eg/orchestration/assignmaintenancepolicy

Method: POST

Content-Type: application/json

Inputs to be Specified
Parameters Key Values Example

Headers

managerurl: Base URL of the eG Manager i.e., http://<IP address of the eG console:Port>

user: eG username or domain/eG username

pwd: Base64 encoded password

{

"policyname":"QMP1",

"associatefor":"Component",

"componentsby": "Component Type",

"componenttype":"microsoft windows",

"associateelements":"windowsos191

,windows195"

}

Body

Default:

{

"policyname":"Policy name"

"associatefor":"Host/Component/Test/
Test For Host/Test For component/
Test For component type"

"componentsby":"Zone/Segment
/Service/Component Type"

"zone":"Zone name"

"segment":"Segment name"

"service":"Service name"

"componenttype":"Component type:port"

"test":"Test name"

"associateelements":"comma-separated list of elements"

"disassociateelements":"comma-
separated list of elements"

}

 

Success Response
Type Code Content

JSON

200

{

"Succeed": "Maintenance policy has been associated/dissociated successfully."

}

 

Failure Response
Type Code Content

JSON

401 UNAUTHORIZED

{

"Error": "Element(s) you are trying to add does/do not exist."

}

Figure 1 : Assigning a Maintenance Policy using Postman REST Client

Assigning a Maintenance Policy using cURL

To assign a maintenance policy through the REST API using cURL, the command should be specified in the following format:

curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/assignmaintenancepolicy" -H "managerurl:http://<eG Manager IP:Port>"-H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: application/json" --data-raw "{'policyname':'Policy name', 'associatefor':'Host/Component/Test/Test For Host/Test For component/Test For component type', 'componentsby':'Zone/Segment/Service/Component Type', 'zone':'Zone name', 'segment':'Segment name', 'service':'Service name', 'componenttype':'Component type', 'test':'Test name', 'associateelements':'comma-separated list of elements', 'disassociateelements':'comma-
separated list of elements'}"

Figure 2 shows an example of assigning a maintenance policy using cURL.

Figure 2 : Assigning a maintenance policy using cURL