openc2lib.core.results
OpenC2 Response Results
This class defines the basic structure for Results carried in a Response. This class can be extended by profiles definitions with additional fields. See the main project documentation to learn more about extensions.
1""" OpenC2 Response Results 2 3 This class defines the basic structure for Results carried in a Response. 4 This class can be extended by profiles definitions with additional fields. 5 See the main project documentation to learn more about extensions. 6""" 7 8from openc2lib.types.base import Map, ArrayOf 9from openc2lib.types.data import Version, ActionTargets, Nsid 10from openc2lib.core.extensions import extensible 11 12 13@extensible 14class Results(Map): 15 """ OpenC2 Response Results 16 17 This class implements the definition in Sec. 3.3.2.2 of the Language Specification. The `Results` carry 18 the output of an OpenC2 Command. This definition only includes basic fields and it is expected to 19 be extended for each `Profile`. 20 21 Extensions must be declared with the `@extension` decorator, including the Namespace Identifier. 22 Extensions must define the additional fields envisioned by the Profile specification in the `fieldtypes` 23 dictionary. 24 """ 25 fieldtypes = dict(versions= ArrayOf(Version), profiles= ArrayOf(Nsid), pairs= ActionTargets, rate_limit= int) 26 """ Field types 27 28 This is the definition of the fields beard by the `Results`. This definition is for internal use only, 29 to parse OpenC2 messages. Extensions must include these fields and add additional definitions. 30 """ 31 32 def set(self, versions=None, profiles=None, pairs=None, rate_limit=None): 33 """ Set values 34 35 This function may be used to set specific values of the `Results`, with a key=value syntax. 36 :param version: List of OpenC2 Versions supported by the Actuator. 37 :param profiles: List of OpenC2 Profiles supported by the Actuator. 38 :param pairs: List of `Targets` applicable to each supported `Action`. 39 :param rate_limit: Maximum number of requests per minute supported by design or policy. 40 :return: None 41 """ 42 self['versions']=versions 43 self['profiles']=profiles 44 self['pairs']=pairs 45 self['rate_limit']=rate_limit
14@extensible 15class Results(Map): 16 """ OpenC2 Response Results 17 18 This class implements the definition in Sec. 3.3.2.2 of the Language Specification. The `Results` carry 19 the output of an OpenC2 Command. This definition only includes basic fields and it is expected to 20 be extended for each `Profile`. 21 22 Extensions must be declared with the `@extension` decorator, including the Namespace Identifier. 23 Extensions must define the additional fields envisioned by the Profile specification in the `fieldtypes` 24 dictionary. 25 """ 26 fieldtypes = dict(versions= ArrayOf(Version), profiles= ArrayOf(Nsid), pairs= ActionTargets, rate_limit= int) 27 """ Field types 28 29 This is the definition of the fields beard by the `Results`. This definition is for internal use only, 30 to parse OpenC2 messages. Extensions must include these fields and add additional definitions. 31 """ 32 33 def set(self, versions=None, profiles=None, pairs=None, rate_limit=None): 34 """ Set values 35 36 This function may be used to set specific values of the `Results`, with a key=value syntax. 37 :param version: List of OpenC2 Versions supported by the Actuator. 38 :param profiles: List of OpenC2 Profiles supported by the Actuator. 39 :param pairs: List of `Targets` applicable to each supported `Action`. 40 :param rate_limit: Maximum number of requests per minute supported by design or policy. 41 :return: None 42 """ 43 self['versions']=versions 44 self['profiles']=profiles 45 self['pairs']=pairs 46 self['rate_limit']=rate_limit
OpenC2 Response Results
This class implements the definition in Sec. 3.3.2.2 of the Language Specification. The Results carry
the output of an OpenC2 Command. This definition only includes basic fields and it is expected to
be extended for each Profile.
Extensions must be declared with the @extension decorator, including the Namespace Identifier.
Extensions must define the additional fields envisioned by the Profile specification in the fieldtypes
dictionary.
Field types
This is the definition of the fields beard by the Results. This definition is for internal use only,
to parse OpenC2 messages. Extensions must include these fields and add additional definitions.
33 def set(self, versions=None, profiles=None, pairs=None, rate_limit=None): 34 """ Set values 35 36 This function may be used to set specific values of the `Results`, with a key=value syntax. 37 :param version: List of OpenC2 Versions supported by the Actuator. 38 :param profiles: List of OpenC2 Profiles supported by the Actuator. 39 :param pairs: List of `Targets` applicable to each supported `Action`. 40 :param rate_limit: Maximum number of requests per minute supported by design or policy. 41 :return: None 42 """ 43 self['versions']=versions 44 self['profiles']=profiles 45 self['pairs']=pairs 46 self['rate_limit']=rate_limit
Set values
This function may be used to set specific values of the Results, with a key=value syntax.
Parameters
- version: List of OpenC2 Versions supported by the Actuator.
- profiles: List of OpenC2 Profiles supported by the Actuator.
- pairs: List of
Targetsapplicable to each supportedAction. - rate_limit: Maximum number of requests per minute supported by design or policy.
Returns
None
Base class
Data types defined in the Language Specification shall not set this field. Data types defined in Profiles that extends a Data Type defined in the Language Specification, must set this field to the corresponding class of the base Data Type.
Note: Extensions defined in the openc2lib context are recommended to use the same name of the base Data Type, and to distinguish them through appropriate usage of the namespacing mechanism.
Registered extensions
Classes that implement a Data Type defined in the Language Specification will use this field to register extensions defined by external Profiles. Classes that define extensions within Profiles shall register themselves according to the specific documentation of the base type class, but shall not modify this field.
Inherited Members
- builtins.dict
- get
- setdefault
- pop
- popitem
- keys
- items
- values
- update
- fromkeys
- clear
- copy