Project-related sandboxes can be created using the script API_SCURTY.CREATE_SBX. The only mandatory parameter is choosing a name for the sandbox. The rest of the variables are optional and can be used to add a description, a comment or the name and e-mail address of the person requesting the sandbox. Furthermore, there are two more optional parameters with default values. One can set the lifetime of the sandbox in days or by leaving it empty set it to the default value of 30 days. By chosing a negative number this results in an indefinite time period. By setting a quota in GB one can set the maximum storage space which can be allocated for the sandbox. By not choosing any quota a quota of 10 GB is set by default.
In this example a description is added and the lifetime and the quota is being set to something else than the default value. However, the comment and the requestor name and mail are set to 'null' as these parameters are optional and not needed for this demonstration.
EXECUTE SCRIPT API_SCURTY.CREATE_SBX (
'TEST_SBX' -- p_sbx_name
,'Test-SBX for testing purposes' -- p_description
,7 -- p_lifetime
,2 -- p_quota
,null -- p_requestor_name
,null -- p_requestor_mail
,null -- p_sbx_comment
);
After having added a project-related sandbox, one can find it in the table SCURTY.SBX_REPO.
SBX_NAME | SBX_TYPE | DESCRIPTION | LIFETIME | QUOTA | REQUESTOR _NAME | REQUESTOR _MAIL | SBX_COMMENT |
---|---|---|---|---|---|---|---|
TEST_SBX | SBX | Test-SBX for testing purposes | 7 | 2 | (null) | (null) | (null) |
If one wants to change any of the settings of a project-related sandbox, one can use the script API_SCURTY.MANAGE_SBX. The only parameter value that needs to be provided is the name of the sandbox, as the system otherwise would not know which sandbox should be modified. By providing a 'null' value, the already existing value for a parameter will be kept. However, by entering anything else the old value will be overwritten with that new value.
In the example below the lifetime value is changed from one week to 5 days and the quota of the sandbox is changed from 2 GB to only 1GB for the sandbox with the name 'TEST_SBX', which has been created in the step above.
EXECUTE SCRIPT API_SCURTY.MANAGE_SBX (
'TEST_SBX' -- p_sbx_name
,null -- p_description
,5 -- p_lifetime
,1 -- p_quota
,null -- p_requestor_name
,null -- p_requestor_mail
,null -- p_sbx_comment
);
After issuing the beforementioned command the entry in the table SCURTY.SBX_REPO will change to the following:
SBX_NAME | SBX_TYPE | DESCRIPTION | LIFETIME | QUOTA | REQUESTOR _NAME | REQUESTOR _MAIL | SBX_COMMENT |
---|---|---|---|---|---|---|---|
TEST_SBX | SBX | Test-SBX for testing purposes | 5 | 1 | (null) | (null) | (null) |
If a project-related sandbox should be dropped, one only has to provide the name of the sandbox that should be dropped to the script API_SCURTY.DROP_SBX.
EXECUTE SCRIPT API_SCURTY.DROP_SBX(
'TEST_SBX' --
);
After the script above is executed the entry for the sandbox with the name 'TEST_SBX' should vanish from the table SCURTY.SBX_REPO.