Class for the <subscription> resource type.
| Method | activate |
This method is called to activate a resource, usually in a CREATE request. |
| Method | child |
Called before a child will be added to a resource. |
| Method | deactivate |
Deactivate an active resource. |
| Method | update |
Update, add or remove resource attributes. |
| Method | validate |
Validate a resource. |
| Class Variable | notification |
Injected NotificationManager instance. |
| Class Variable | validator |
Injected Validator instance. |
| Method | _check |
Check whether an observed child resource types are actually allowed by the parent. |
| Method | _has |
Check whether a list of Notification Event Types contains at least one of the blocking notification event types. |
| Method | _has |
Check whether a dictionary contains "disallowed" attributes. "Disallowed" attributes are any of the resource specific attributes that are not allowed for the blocking Notification Event Types. |
| Method | _has |
Check whether a dictionary contains "disallowed" Event Notification Criteria attributes.This is used mainly to validate the blocking-* Notification Event Types. |
| Class Variable | _allowed |
These are the only allowed ENC attributes. |
| Class Variable | _disallowed |
These attributes are not allowed in blocking-* subscription. |
Inherited from Resource:
| Method | __contains__ |
Implementation of the membership test operator. |
| Method | __delitem__ |
Implementation of the self[key| operation for deleting attributes. |
| Method | __eq__ |
Test for equality of the resource to another resource. |
| Method | __getattr__ |
Map the normal object attribute access to the internal resource attribute dictionary. |
| Method | __getitem__ |
Implementation of the self[key| operation for retrieving attributes. |
| Method | __init__ |
Initialization of a Resource instance. |
| Method | __repr__ |
Object representation as string. |
| Method | __setitem__ |
Implementation of the self[key] operation for assigning to attributes. |
| Method | __str__ |
String representation of the resource's attributes. |
| Method | as |
Get the JSON resource representation. |
| Method | attribute |
Return the value of an attribute. |
| Method | can |
Check whether resource is a valild child resource for this resource. |
| Method | child |
Called after a child resource was added to the resource. |
| Method | child |
Called when a child resource of the resource was removed. |
| Method | child |
Called when a child resource was updated. |
| Method | create |
Create a child resource from a JSON dictionary. |
| Method | db |
Add the resource to the database. |
| Method | db |
Delete the resource from the database. |
| Method | db |
Load a new copy of the same resource from the database. |
| Method | db |
Reload the resource instance from the database. |
| Method | db |
Update the resource in the database. |
| Method | decrement |
Decrement the subscription counter for the resource. |
| Method | del |
Delete the attribute 'key' from the resource. |
| Method | get |
Get all attributes of the resource. |
| Method | get |
Retrieve the current originator. This could be different from the originator / creator of the resource in case of the custodian attribute is set. |
| Method | get |
Determine and return the final value of an attribute during an update. |
| Method | get |
Retrieve a resource's location coordinates (internal attribute). |
| Method | get |
Retrieve a resource's originator. |
| Method | get |
Retrieve a resource's release version indicator. |
| Method | get |
Retrieve a resource's full structured resource name. |
| Method | get |
Retrieve the subscription counter for the resource. |
| Method | handle |
Process a CREATE request that is directed to a virtual resource. |
| Method | handle |
Process a DELETE request that is directed to a virtual resource. |
| Method | handle |
Process a notification request that is directed to a resource. |
| Method | handle |
Process a RETRIEVE request that is directed to a virtual resource. |
| Method | handle |
Process a UPDATE request that is directed to a virtual resource. |
| Method | has |
Check whether an attribute exists for the resource. |
| Method | has |
Test whether a resource supports the specified attribute. This method may be overwritten in sub-classes, for example for virtual resources. |
| Method | increment |
Increment the subscription counter for the resource. |
| Method | initialize |
This method is called when a new resource is created and before written to the database. |
| Method | is |
Test whether a the resource's type is an announced type. |
| Method | is |
Test whether a resource has been created for another resource. |
| Method | is |
Test whether this resource has been modified after another resource. |
| Method | is |
Test whether the resource is a virtual resource. |
| Method | retrieve |
Retrieve the parent resource of this resouce. |
| Method | retrieve |
Retrieve the raw (!) parent resource of this resouce. |
| Method | select |
Determine the selected attributes for a partial retrieve of a resource. |
| Method | set |
Assign a value to a resource attribute. |
| Method | set |
Save the resource ID for which this resource was created for. |
| Method | set |
Set a resource's location coordinates (internal attribute). |
| Method | set |
Set a resource's originator. |
| Method | set |
Set the resource ID for the resource if not already set. |
| Method | set |
Set the resource name. |
| Method | set |
Assign the release version for a resource. |
| Method | set |
Set a resource's full structured resource name. |
| Method | structured |
Determine the structured path of a resource. |
| Method | type |
Return the resource type as a string. If the resource is a flex container, the specialization is added. |
| Method | updated |
Signal to a resource that is was successfully updated. |
| Method | will |
This method is called before a resource will be deactivated. |
| Method | will |
This method is called before a resource will be send back in a RETRIEVE response. |
| Method | will |
This method is called before a resource will be updated and before calling the update() method. |
| Class Variable | __slots__ |
Slots for the class. |
| Class Variable | dispatcher |
Injected Dispatcher instance. |
| Class Variable | factory |
Injected Factory instance. |
| Class Variable | importer |
Injected Importer instance. |
| Class Variable | request |
Injected RequestManager instance. |
| Class Variable | storage |
Injected Storage instance. |
| Instance Variable | dict |
Dictionary for public and internal resource attributes. |
| Method | _check |
Check whether a referenced ACP resoure exists, and if yes, change the ID in the list to CSE relative unstructured format. |
| Method | _normalize |
Normalize the URLs in the given attribute. |
| Class Variable | _exclude |
Resource attributes that are excluded when updating the resource |
| Instance Variable | _original |
Original dictionary as it was created. This is used for validation in activate() later. |
This method is called to activate a resource, usually in a CREATE request.
This is not always the case, e.g. when a resource object is just used temporarly. NO notification on activation/creation happens in this method!
This method is implemented in sub-classes as well.
| Parameters | |
parentResource | The resource's parent resource. |
originator:str | The request's originator. |
| Raises | |
BAD_REQUEST | In case of an invalid attribute. |
Called before a child will be added to a resource.
This method is implemented in some sub-classes.
| Parameters | |
childResource | Resource that will be added as a child to the resource. |
originator:str | The request originator. |
Deactivate an active resource.
This usually happens when creating the resource via a request. A subscription check for deletion is performed.
This method is implemented in sub-classes as well.
| Parameters | |
originator:str | The requests originator that let to the deletion of the resource. |
parentResource | The resource's parent resource. |
JSON | None = None, originator: str | None = None, doValidateAttributes: bool | None = True):
¶
acme.resources.Resource.Resource.updateUpdate, add or remove resource attributes.
A subscription check for update is performed.
This method is implemented in sub-classes as well.
Note
This method updates the resource in the database. It should be called only after all other checks where performed.
| Parameters | |
dct:JSON | None | An optional JSON dictionary with the attributes to be updated. |
originator:str | None | The optional requests originator that let to the update of the resource. |
dobool | None | If True optionally call the resource's validate() method. |
| Raises | |
CONTENTS_UNACCEPTABLE | In case of a resource mismatch. |
BAD_REQUEST | In case of an invalid attribute. |
INTERNAL_SERVER_ERROR | In case the parent resource coudln't be retrieved. |
str | None = None, dct: JSON | None = None, parentResource: Resource | None = None):
¶
Validate a resource.
Usually called within activate() or update() methods.
This method is implemented in some sub-classes.
- Raises
BAD_REQUEST: In case of a validation error.
| Parameters | |
originator:str | None | Optional request originator |
dct:JSON | None | Updated attributes to validate |
parentResource | None | The parent resource |
Check whether an observed child resource types are actually allowed by the parent.
| Parameters | |
parentResource | The resource to check. |
chty:list[ | A list of resource types to check. |
| Raises | |
BAD_REQUEST | In case the observed child resource type is not allowed. |
Check whether a list of Notification Event Types contains at least one of the blocking notification event types.
| Parameters | |
net:list[ | List of Notification Event Types. |
| Returns | |
bool | True, if the list contains at least one of the blocking NotificationEventType. |
Check whether a dictionary contains "disallowed" attributes. "Disallowed" attributes are any of the resource specific attributes that are not allowed for the blocking Notification Event Types.
| Parameters | |
dct:JSON | Either a resource dict or an update dict. |
| Returns | |
bool | True if the dct has any disallowed attributes. |
Check whether a dictionary contains "disallowed" Event Notification Criteria attributes.This is used mainly to validate the blocking-* Notification Event Types.
| Parameters | |
dct:JSON | A Event Notification Criteria structure. |
| Returns | |
bool | True if the dct has any disallowed attributes. |