Alter
Alter an existing general resource profile.
ResourceAdmin.alter()
def alter(self, resource: str, class_name: str, traits: dict) -> Union[dict, bytes]:
📄 Description
Only a subset of available Segments and Traits are considered Stable. See Segments and Traits for more details.
Alter operations in pyracf require READ access to
IRR.IRRSMO00.PRECHECK
in theXFACILIT
class This function will not produce output unless the user running the command has this access.
Alter an existing general resource profile.
📥 Parameters
-
resource
The name of the general resource profile being altered. -
class_name
The name of the class the general resource profile being altered belongs to. -
traits
A dictionary of traits/attributes that should be given to the resource. See Traits to see what all of the valid Resource Traits are.
📤 Returns
Union[dict, bytes]
Returns a Security Result dictionary or Security Request XML bytes if theResourceAdmin.generate_requests_only
class attribute is set toTrue
.
❌ Raises
SecurityRequestError
RaisesSecurityRequestError
when the SAF Return Code of a Security Result is equal to4
.DownstreamFatalError
RaisesDownstreamFatalError
when the SAF Return Code of a Security Result is greater than4
.AlterOperationError
RaisesAlterOperationError
when the general resource profile cannot be altered because it does NOT exist.SegmentTraitError
RaisesSegmentTraitError
when the dictionary of traits/attributes provided contains one or more unknown traits.
💻 Example
The following example alters a general resource profile called ESWIFT.TEST.T1136242.P3020470
with traits/attributes to alter specified in the traits
dictionary.
Python Script
from pyracf import ResourceAdmin
resource_admin = ResourceAdmin()
traits = {
"base:universal_access": "Read",
"base:owner": "eswift",
}
resource_admin.alter("TESTING","ELIJTEST", traits=traits)
Security Result Dictionary as JSON
{
"securityResult": {
"resource": {
"name": "TESTING",
"class": "ELIJTEST",
"operation": "set",
"requestId": "ResourceRequest",
"info": [
"Definition exists. Add command skipped due to precheck option"
],
"commands": [
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "RALTER ELIJTEST (TESTING) UACC (Read) OWNER (eswift)",
"messages": [
"ICH11009I RACLISTED PROFILES FOR ELIJTEST WILL NOT REFLECT THE UPDATE(S) UNTIL A SETROPTS REFRESH IS ISSUED."
]
}
]
},
"returnCode": 0,
"reasonCode": 0,
"runningUserid": "testuser"
}
}