Role Assignment Report

Generates a Simplified Role Assignment Report of service users in the system and writes the report to the filename provided. This report can then be downloaded using the Download API.

This is an asynchronous job and uses the job status URI to determine if the operation is complete.

The presence of status -1 in the response indicates that the generation of Role Assignment Report is in progress. Use the job status URI to determine whether the generation of Role Assignment Report is complete. Any non-zero status except -1 indicates failure of generating Role Assignment Report.

This API is version v1.

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See About the REST APIs. Using these REST APIs requires prerequisites. See Prerequisites.

Table 8-29 User Access Report

Task Request REST Resource
Role Assignment Report POST

/interop/rest/security/{api_version}/roleassignmentreport/

Role Assignment Report Status GET

/interop/rest/security/{api_version}/jobs/{jobId}

REST Resource

POST /interop/rest/{api_version}/security/{api_version}/roleassignmentreport

Parameters:

The following table summarizes the request parameters.

Table 8-30 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
fileName File where the report is to be populated, such as roleAssignmentReport.csv Form Yes None

Response

Supported Media Types: application/json

Table 8-31 Parameters

Parameters Description
details In case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Can be self and/or Job Status. If set to Job Status, you can use the href to get the status of the import operation
data Parameters as key value pairs passed in the request

Examples of Response Body

The following show examples of the response body in JSON format.

Response 1 example when job is in progress:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": "<filename>"
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobId>",
            "rel": "Job Status"
        }
    ],
    "status": -1,
    "details": null,
    "items": null
}

Response 2 example when job completes with errors:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": " "
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/{api_version}/roleassignmentreport",
            "rel": "self"
        }
    ],
    "status": 1,
    "details": "EPMCSS-20665: Failed to generate Role Assignment Report. Invalid or insufficient parameters are passed with command. Please provide all required parameters with REST command. ",
    "items": null
}

Response 3 example when job completes without errors:

{
    "links": [
        {
            "data": null,
            "action": "GET",
            "href": " https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobID>",
            "rel": "self"
        }
    ],
    "status": 0,
    "details": null,
    "items": null
}

Example 8-21 Java Sample Code

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Java

public void generateRoleAssignmentReport(String fileName) {
		try {
			String url = this.serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport";
			Map<String, String> reqHeaders = new HashMap<String, String>();
			reqHeaders.put("Authorization", "Basic " + DatatypeConverter
					.printBase64Binary((this.userName + ":" + this.password).getBytes(Charset.defaultCharset())));

			Map<String, String> reqParams = new HashMap<String, String>();
			reqParams.put("filename", fileName);
		
			Map<String, String> restResult = CSSRESTHelper.callRestApi(new HashMap(), url, reqHeaders, reqParams,
					"POST");
			String jobStatus = CSSRESTHelper.getCSSRESTJobCompletionStatus(restResult, reqHeaders);
			System.out.println(jobStatus);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

Example 8-22 Shell Script Sample code

Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)

Common Functions: See CSS Common Helper Functions for cURL

funcGenerateRoleAssignmentReport() {
        url="$SERVER_URL/interop/rest/security/$API_VERSION/roleassignmentreport"
        params="filename=$1"
        header="Content-Type: application/x-www-form-urlencoded;charset=UTF-8"
        cssRESTAPI="generateRoleAssignmentReport"
        statusMessage=$(funcCSSRESTHelper "POST" "$url" "$header" "$USERNAME" "$PASSWORD" "$params" "$cssRESTAPI")
        echo $statusMessage
}	

Example 8-23 Groovy Sample Code

Common Functions: See CSS Common Helper Functions for Groovy

def generateRoleAssignmentReport(fileName) {

	String scenario = "Generating Role assignment report in " + fileName;
	String params = "jobtype=GENERATE_ROLE_ASSIGNMENT_REPORT&filename="+ fileName;
	def url = null;
	def response = null;
	try {
		url = new URL(serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport");
	} catch (MalformedURLException e) {
		println "Please enter a valid URL"
		System.exit(0);
	}
	response = executeRequest(url, "POST", params, "application/x-www-form-urlencoded");
	if (response != null) {
		getJobStatus(getUrlFromResponse(scenario, response, "Job Status"), "GET");
	}
}