Add
Create a new data set profile.
DataSetAdmin.add()
def add(
self,
data_set: str,
traits: dict = {},
volume: Union[str, None] = None,
generic: bool = False
) -> Union[dict, bytes]:
📄 Description
Only a subset of available Segments and Traits are considered Stable. See Segments and Traits for more details.
Create a new data set profile.
📥 Parameters
-
data_set
The name of the data set profile being created. -
traits
A dictionary of traits/attributes that should be given to the data set profile on creation. See Traits to see what all of the valid Data Set Traits are. -
volume
A single volume name for this data set profile. This argument is optional. Ifgeneric=True
is specified, volume is ignored. -
generic
A bool indicating whether to treat this profile as generic or not. This argument is optional and defaults toFalse
.
📤 Returns
Union[dict, bytes]
Returns a Security Result dictionary or Security Request XML bytes if theDataSetAdmin.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
.AddOperationError
RaisesAddOperationError
when the data set profile cannot be added because it already exists.SegmentTraitError
RaisesSegmentTraitError
when the dictionary of traits/attributes provided contains one or more unknown traits.
💻 Example
The following example creates a new data set profile called ESWIFT.TEST.T1136242.P3020470
with two traits/attributes as defined in the traits
dictionary.
Python Script
from pyracf import DataSetAdmin
data_set_admin = DataSetAdmin()
traits = {
"base:universal_access": "None",
"base:owner": "eswift",
}
data_set_admin.add("ESWIFT.TEST.T1136242.P3020470", traits=traits)
Security Result Dictionary as JSON
{
"securityResult": {
"dataSet": {
"name": "ESWIFT.TEST.T1136242.P3020470",
"operation": "set",
"generic": "no",
"requestId": "DatasetRequest",
"commands": [
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ADDSD ('ESWIFT.TEST.T1136242.P3020470')"
},
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ALTDSD ('ESWIFT.TEST.T1136242.P3020470') UACC (None) OWNER (eswift)"
}
]
},
"returnCode": 0,
"reasonCode": 0,
"runningUserid": "testuser"
}
}
💻 Example
The following example creates a new generic data set profile called ESWIFT.TEST.**
with two traits/attributes as defined in the traits
dictionary.
Python Script
from pyracf import DataSetAdmin
data_set_admin = DataSetAdmin()
traits = {
"base:universal_access": "None",
"base:owner": "eswift",
}
data_set_admin.add("ESWIFT.TEST.**", traits=traits, generic=True)
Security Result Dictionary as JSON
{
"securityResult": {
"dataSet": {
"generic": "yes",
"name": "ESWIFT.TEST.**",
"operation": "set",
"requestId": "DatasetRequest",
"commands": [
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ADDSD ('ESWIFT.TEST.**') GENERIC "
},
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ALTDSD ('ESWIFT.TEST.**') GENERIC UACC (None) OWNER (eswift)"
}
]
},
"returnCode": 0,
"reasonCode": 0,
"runningUserid": "testuser"
}
}