Result
CollectResult
¶
Class for managing a collection of Aria Operations Objects
Source code in lib/python/src/aria/ops/result.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
__init__(obj_list=None, target_definition=None)
¶
Initializes a Result
A result contains objects, which can be added at initialization or later. Each object has a key containing one or more identifiers plus the object type and adapter type. Keys must be unique across objects in a Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj_list |
Optional[List[Object]]
|
an optional list of objects to send to Aria Operations. Objects can be added later using add_object. Defaults to None |
None
|
target_definition |
AdapterDefinition
|
an optional description of the returned objects, used for validation purposes. Defaults to None. |
None
|
Source code in lib/python/src/aria/ops/result.py
add_object(obj)
¶
Adds the given object to the Result and returns it.
Adds the given object to the Result and returns it. A different object with the same key cannot already exist in the Result. If it does, an ObjectKeyAlreadyExistsException will be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
Object
|
An object to add to the Result. |
required |
Returns:
Name | Type | Description |
---|---|---|
Object |
Object
|
The object. |
Raises:
Type | Description |
---|---|
ObjectKeyAlreadyExistsException
|
If a different object with the same key already exists in the Result. |
Source code in lib/python/src/aria/ops/result.py
add_objects(obj_list)
¶
Adds the given objects to the Result and returns it.
Adds the given objects to the Result. A different object with the same key
cannot already exist in the Result. If it does, an
:class:ObjectKeyAlreadyExistsException
will be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj_list |
List[Object]
|
A list of objects to add to the Result |
required |
Returns:
Type | Description |
---|---|
None
|
The object |
Raises:
Type | Description |
---|---|
ObjectKeyAlreadyExistsException
|
if a different object with the same key already exists in the Result |
Source code in lib/python/src/aria/ops/result.py
get_json()
¶
Get a JSON representation of this Result
Returns a JSON representation of this Result in the format required by Aria Operations. The representation includes all objects (including the object's events, properties, and metrics) in the Result. Relationships are returned following the update_relationships flag (See RelationshipUpdateMode).
Returns:
Type | Description |
---|---|
dict
|
A JSON representation of this Result |
Source code in lib/python/src/aria/ops/result.py
get_object(obj_key)
¶
Get and return the object corresponding to the given key, if it exists
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj_key |
Key
|
The object key to search for |
required |
Returns:
Type | Description |
---|---|
Optional[Object]
|
The object with the given key, or None if the key is not in the result |
Source code in lib/python/src/aria/ops/result.py
get_objects_by_type(object_type, adapter_type=None)
¶
Returns all objects with the given type. If adapter_type is present, the objects must also be from the given adapter type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_type |
str
|
The object type to return |
required |
adapter_type |
Optional[str]
|
The adapter type of the objects to return. Defaults to None |
None
|
Returns:
Type | Description |
---|---|
List[Object]
|
A list of objects matching the object type and adapter type |
Source code in lib/python/src/aria/ops/result.py
object(adapter_kind, object_kind, name, identifiers=None)
¶
Get or create the object with key specified by adapter_kind, object_kind, name, and identifiers.
This is the preferred method for creating new Objects. If this method is used exclusively, all object references with the same key will point to the same object.
If an object with the same key already exists in the result, return that
object, otherwise create a new object, add it to the result, and return it.
See discussion on keys in the documentation for the :class:object.Key
class.
If this method is used to create an object, it does not need to be added
later using add_object
(or add_objects
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adapter_kind |
str
|
The adapter kind of the object |
required |
object_kind |
str
|
The resource kind of the object |
required |
name |
str
|
The name of the object |
required |
identifiers |
Optional[List[Identifier]]
|
An optional list of Identifiers for the object |
None
|
Returns:
Type | Description |
---|---|
Object
|
The object with the given key |
Source code in lib/python/src/aria/ops/result.py
send_results(output_pipe=sys.argv[-1])
¶
Opens the output pipe and sends results directly back to the server
This method can only be called once per collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_pipe |
str
|
The path to the input pipe. Defaults to sys.argv[-1] |
argv[-1]
|
Source code in lib/python/src/aria/ops/result.py
with_error(error_message)
¶
Set the Adapter Instance to an error state with the provided message.
If this method is called multiple times, only the most recent error message will be recorded. If error_message is set, no results (objects, relationships) will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error_message |
str
|
A string containing the error message |
required |
Source code in lib/python/src/aria/ops/result.py
EndpointResult
¶
Class for managing the results of an adapter instance get endpoint URLs call
The result of this should be a set of urls that the adapter will connect to. Aria Operations will then attempt to connect to each of these urls securely, and prompt the user to accept or reject the certificate presented by each URL.
Source code in lib/python/src/aria/ops/result.py
__init__()
¶
get_json()
¶
Get a JSON representation of this EndpointResult
Returns a JSON representation of this EndpointResult in the format required by Aria Operations.
Returns:
Type | Description |
---|---|
dict
|
A JSON representation of this EndpointResult |
Source code in lib/python/src/aria/ops/result.py
send_results(output_pipe=sys.argv[-1])
¶
Opens the output pipe and sends results directly back to the server
This method can only be called once per collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_pipe |
str
|
The path to the input pipe. Defaults to sys.argv[-1] |
argv[-1]
|
Source code in lib/python/src/aria/ops/result.py
with_endpoint(endpoint_url)
¶
Adds an endpoint to the list of endpoints Aria Operations will test for certificate validation.
If this method is called multiple times, each url will be called by Aria Operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint_url |
srt
|
A string containing the url |
required |
Source code in lib/python/src/aria/ops/result.py
ObjectKeyAlreadyExistsException
¶
Bases: Exception
Exception when two objects with the same Key are added to the same
:class:Result
RelationshipUpdateModes
¶
Bases: Enum
If 'update_relationships' is 'ALL', all relationships between objects are returned. This mode will remove any currently-existing relationships in VMware Aria Operations that are not present in the Result.
If 'update_relationships' is 'NONE', no relationships will be returned, even if there are relationships between objects in the Result. All currently-existing relationships in VMware Aria Operations will be preserved.
If 'update_relationships' is 'AUTO' (or not explicitly set), then the mode will behave like 'ALL' if any object in the Result has at least one relationship, otherwise the mode will behave like 'NONE' if no objects have any relationships in the Result. This default behavior makes it easy to skip collecting all relationships for a collection without overwriting previously-collected relationships, e.g., for performance reasons.
If 'update_relationships' is 'PER_OBJECT', then only objects with updated relationships will be returned. This is similar to 'AUTO' except that if an object's child relationships have not been updated/set (by calling 'add_child' or 'add_children'), existing child relationships in VMware Aria Operations will be preserved. This means that to remove all relationships from an object (without setting any new relationships), the adapter must call 'add_children' on the object with an empty collection of children. This mode is useful for updating a subset of objects' relationships in a collection, but requires more care to ensure relationships are removed when appropriate.
Source code in lib/python/src/aria/ops/result.py
TestResult
¶
Class for managing the results of an adapter instance connection test
Source code in lib/python/src/aria/ops/result.py
__init__()
¶
get_json()
¶
Get a JSON representation of this TestResult
Returns a JSON representation of this TestResult in the format required by Aria Operations, indicating either a successful test, or a failed test with error message.
Returns:
Type | Description |
---|---|
dict
|
A JSON representation of this TestResult |
Source code in lib/python/src/aria/ops/result.py
is_success()
¶
send_results(output_pipe=sys.argv[-1])
¶
Opens the output pipe and sends results directly back to the server
This method can only be called once per collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_pipe |
str
|
The path to the input pipe. Defaults to sys.argv[-1] |
argv[-1]
|
Source code in lib/python/src/aria/ops/result.py
with_error(error_message)
¶
Set the adapter instance connection test to failed, and display the given error message.
If this method is called multiple times, only the most recent error message will be recorded. If error_message is set, the test is considered failed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error_message |
str
|
A string containing the error message |
required |