Create Role

Scenario Overview

Create New Role information in the Crosswork. Client provides request with Specification of the role. The key represents the role ID. The value represents the role specification.

Prerequisites

Before running this example, ensure to obtain access token. Refer 'Getting Started' section.

Create Role

Run the script _create_role from the example directory.

cd cnc-rbac-api-examples;./create_role.sh

Script Details

#!/bin/bash
. ./cnc-api-common.sh

create_role() {
    # assume cnc jwt is obtained prior to invoking this method by executing get-cnc-jwt.sh script
    # read from jwt file and export it as AUTH_TOKEN_HDR
     export_jwt

    # STEP 1 :  User to update input json with details of job to be created in the file CNC_API_INPUT
    # STEP 2 :  trigger create role API
    # STEP 3 :  store the output in CNC_API_OUTPUT file

    CNC_RBAC_API=$CNC_RBAC_API_CTX/role
    CNC_API_INPUT="@$PRJ/input/create_role.json"	 
    CNC_API_OUTPUT="$PRJ/output/create_role_response.json"
    http_post $CNC_API_URL $CNC_API_INPUT $CNC_API_OUTPUT
    
}
create_role