Workload Management

The following operations can be performed with the Workload Rules:

GET /enable
PUT /enable
GET /rules
POST /rules
PUT /rules
DELETE /rules
GET /rules/effective
GET /rules/effective/member
GET /rules/effective/member/resource

GET /enable

This API is used to get enabled status of workload management.

Parameters:

None

Example to get status of workload management

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/enable"

PUT /enable

This API is used to enable or disable workload management.

Parameters:

Name

Description

Parameter Type

Data Type

body

 

body

integer

Example to enable workload

curl -X PUT -u admin:admin "http://localhost:9400/rest/workload/v1/enable" -H "Content-Type:application/json" -d "1"

Example to disable workload

curl -X PUT -u admin:admin "http://localhost:9400/rest/workload/v1/enable" -H "Content-Type:application/json" -d "0"

GET /rules

This API is used to get workload rules.

Parameters:

Name

Description

Parameter Type

Data Type

ruleName

 

query

string

Example to get all workload rules that exist in the server.

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules"

Example to get workload rule "rule1"

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules?ruleName=rule1"

POST /rules

This API is used to create workload rules by specifying the filters, resource and member assignments.

Parameters:

Name

Description

Parameter Type

Data Type

body

Workload rule

body

Array[#/definitions/WorkloadRuleBean]

Request Body

Example Value - Schema

{
“ruleName”: “string”,
“ruleType: “ROW_LIMIT”,
“maxRowCount”: 0,
“enabled”: true,
“annotation”: “string”,
“memberAssignments”: [
{
“domainName”: “string”,
“memberName”: “string”,
“group”: true
}
],
“resourceAssignments”: [
{
“resourcePath”: “string”,
“resourceType”: “string”
}
],
“memoryLimitPercentage”: 0,
“actionTypes”: “NOOP”
],
“emailActionData”: {
“from”: “string”,
“replyTo”: “string”,
“to”: [
“string”
],
“cc”: [
“string”
],
“bcc”: [
“string”
],
“subject”: “string”,
“content”: “string”
},
“maxRequestTime” 0,
“maxRequestTimeUnit”: “NANOSECONDS”,
“newRuleName”: “string”,
“customMessage”: “string”
}
]

Example to create workload rule "rule1"

curl -X POST -u admin:admin "http://localhost:9400/rest/workload/v1/rules" -H "Content-Type:application/json" -d "[{\"ruleName\":\"rule1\",\"enabled\":\"true\",  \"actionTypes\":[\"NOOP\"], \"ruleType\":\"FULL_TABLE_SCAN\", \"annotation\":\"Rule to disallow select *\", \"memberAssignments\":[{\"domainName\":\"composite\", \"memberName\":\"customuser\", \"group\":\"false\"}], \"resourceAssignments\":[{\"resourcePath\":\"/services/databases/foo/customers\", \"resourceType\":\"TABLE\"}] }]"

PUT /rules

This API is used to update workload rules.

Parameters:

None

Request Body

Example Value - Schema

{
“ruleName”: “string”,
“ruleType: “ROW_LIMIT”,
“maxRowCount”: 0,
“enabled”: true,
“annotation”: “string”,
“memberAssignments”: [
{
“domainName”: “string”,
“memberName”: “string”,
“group”: true
}
],
“resourceAssignments”: [
{
“resourcePath”: “string”,
“resourceType”: “string”
}
],
“memoryLimitPercentage”: 0,
“actionTypes”: “NOOP”
],
“emailActionData”: {
“from”: “string”,
“replyTo”: “string”,
“to”: [
“string”
],
“cc”: [
“string”
],
“bcc”: [
“string”
],
“subject”: “string”,
“content”: “string”
},
“maxRequestTime” 0,
“maxRequestTimeUnit”: “NANOSECONDS”,
“newRuleName”: “string”,
“customMessage”: “string”
}
]

Example to update workload rule "/policy/workload/rule1" enabled status and rule type

curl -X PUT -u admin:admin "http://localhost:9400/rest/workload/v1/rules" -H "Content-Type:application/json" -d "[{\"ruleName\":\"rule1\",\"enabled\":\"false\",  \"actionTypes\":[\"NOOP\"], \"ruleType\":\"ROW_LIMIT\", \"annotation\":\"Rule to limit rows\", \"maxRowCount\":\"10\", \"memberAssignments\":[{\"domainName\":\"composite\", \"memberName\":\"customuser\", \"group\":\"false\"}], \"resourceAssignments\":[{\"resourcePath\":\"/services/databases/foo/customers\", \"resourceType\":\"TABLE\"}] }]"

 

Example to rename workload rule "/policy/workload/rule1" to "/policy/workload/rule2"

curl -X PUT -u admin:admin "http://localhost:9400/rest/workload/v1/rules" -H "Content-Type:application/json" -d "[{\"ruleName\":\"rule1\",\"newRuleName\":\"rule2\", \"enabled\":\"true\",  \"actionTypes\":[\"NOOP\"], \"ruleType\":\"ROW_LIMIT\", \"annotation\":\"Rule to limit rows\", \"maxRowCount\":\"10\", \"memberAssignments\":[{\"domainName\":\"composite\", \"memberName\":\"customuser\", \"group\":\"false\"}], \"resourceAssignments\":[{\"resourcePath\":\"/services/databases/foo/customers\", \"resourceType\":\"TABLE\"}] }]"

DELETE /rules

This API is used to delete workload rules.

Parameters:

None

Request Body

Example Value - Schema

[
“string”
]

Example to delete workload rules

curl -X DELETE -u admin:admin "http://localhost:9400/rest/workload/v1/rules" -H "Content-Type:application/json" -d "[\"rule1\", \"rule2\"]"

GET /rules/effective

This API is used to get effective rules of a resource.

Parameters:

Name

Description

Parameter Type

Data Type

resourceIds

resource ids

query

Array[integer]

Example to get effective rules of a resource

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules/effective?resourceIds=10128&resourceIds=10138"

GET /rules/effective/member

This API is used to get workload rules of a user/group.

Parameters:

Name

Description

Parameter Type

Data Type

memberDomain

The domain of the user.

query

string

memberName

The name of the user

query

string

Example to get all workload rules that exist in the server.

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules/effective/member"

 

Example to get effective workload rules of a user "u1"

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules/effective/member?memberDomain=composite&memberName=u1"

GET /rules/effective/member/resource

This API is used to get effective workload rules of a user/group for specified resource path types.

Parameters:

Name

Description

Parameter Type

Data Type

memberDomain

The domain name of user/group.

query

string

memberName

The name of the user/group

query

string

resourcePath

Resource path

query

string

resourceType

Resource type

query

string

Example to get all workload rules that exist in the server.

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules/effective/member/resource" -H "Content-Type:application/json" -d "[]" 

Example to get all effective workload rules for specified resource path types

curl -X GET -u admin:admin "http://localhost:9400/rest/workload/v1/rules/effective/member/resource?memberDomain=composite&memberName=u1&resourcePath=/services/databases/foo/customers&resourceType=TABLE""