Object
Identifier
¶
Represents a piece of data that identifies an Object.
Source code in lib/python/src/aria/ops/object.py
__init__(key, value, is_part_of_uniqueness=True)
¶
Creates an identifier which is used as part of an Object's identification in a :class:Key
.
This class represents a piece of data that identifies an Object. If is_part_of_uniqueness
is False, this data
can change over time without creating a new Object. This is primarily used for human-readable values that are
useful in identification purposes, but may change at times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
A key that determines which identifier the value corresponds to. |
required |
value |
str
|
The value of the identifier. |
required |
is_part_of_uniqueness |
bool
|
Determines if this key/value pair is used in the identification process. |
True
|
Source code in lib/python/src/aria/ops/object.py
get_json()
¶
Get a JSON representation of this Identifier.
This method returns a JSON representation of this Identifier in the format required by vROps.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A JSON representation of this Identifier. |
Source code in lib/python/src/aria/ops/object.py
IdentifierUniquenessException
¶
Bases: Exception
Exception when two Objects of the same type have the same identifier but the is_part_of_uniqueness
attribute
does not match.
Key
¶
Object's Key class, used for identifying Objects
Objects are identified by the Adapter Kind, Object Kind, and one or more Identifiers.
Identifiers can be either the Object's 'name', or one or more 'Identifier' key-value pairs. In order for an 'Identifier' to be used for identification, it must have 'is_part_of_uniqueness' set to True (this is the default).
Two Objects with the same Key are not permitted in a :class:Result
.
Objects must be created with the full key. Keys should not change after the Object has been created.
All Objects with the same Adapter Kind and Object Kind must have the same set of Identifiers that have 'is_part_of_uniqueness' set to True.
Source code in lib/python/src/aria/ops/object.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
__init__(adapter_kind, object_kind, name, identifiers=None)
¶
Initializes a Key, which uniquely identifies a vROps Object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adapter_kind |
str
|
The Adapter Kind this Object is associated with. |
required |
object_kind |
str
|
The Object Kind (e.g., class) of this Object. |
required |
name |
str
|
A human-readable name for this Object. Should be unique if possible. |
required |
identifiers |
Optional[List[Identifier]]
|
A list of :class: |
None
|
Source code in lib/python/src/aria/ops/object.py
get_identifier(key, default_value=None)
¶
Return the value for the given identifier key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The identifier key. |
required |
default_value |
Optional[str]
|
An optional default value. |
None
|
Returns:
Type | Description |
---|---|
Optional[str]
|
The value associated with the identifier. |
Optional[str]
|
If the value associated with the identifier is empty and 'default_value' is |
Optional[str]
|
provided, returns 'default_value'. |
Optional[str]
|
If the identifier does not exist, returns default_value if provided, else 'None'. |
Source code in lib/python/src/aria/ops/object.py
get_json()
¶
Get a JSON representation of this Key.
This method returns a JSON representation of this Key in the format required by vROps.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A JSON representation of this Key. |
Source code in lib/python/src/aria/ops/object.py
Object
¶
Represents an Object (resource) in vROps.
Contains :class:Metric
, :class:Property
, :class:Event
, and relationships to other Objects. Each Object is
identified by a unique :class:Key
.
Source code in lib/python/src/aria/ops/object.py
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 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
__init__(key)
¶
Create a new Object with a given Key.
This method is the preferred way to create a new Object. It should be called from the :class:Result.object
method on the :class:Result
class, which ensures that for a given key only one Object exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
Key
|
The :class: |
required |
Source code in lib/python/src/aria/ops/object.py
adapter_type()
¶
Get the adapter type of this object
Returns:
Type | Description |
---|---|
str
|
The adapter type of this object |
add_child(child)
¶
Method that adds a child Object to this Object.
This Object will also be added as a parent to the child.
Relationship cycles are not permitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
child |
Object
|
Child :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_children(children)
¶
Method that adds a list of child Objects to this Object.
This Object will also be added as a parent to each of the children.
Relationship cycles are not permitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
children |
List[Object]
|
A list of child :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_event(event)
¶
Method that adds a single Event to this Object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Event
|
An :class: |
required |
add_events(events)
¶
Method that adds a list of Events to this Object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
events |
List[Event]
|
A list of :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_metric(metric)
¶
Adds a single Metric data point to this Object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metric |
Metric
|
A Metric data point to add to this Object. |
required |
add_metrics(metrics)
¶
Adds a list of Metric data points to this Object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metrics |
List[Metric]
|
A list of Metric data points to add to this Object. |
required |
Source code in lib/python/src/aria/ops/object.py
add_parent(parent)
¶
Method that adds a parent Object to this Object.
This Object will also be added as a child to the parent.
Relationship cycles are not permitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
Object
|
Parent :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_parents(parents)
¶
Method that adds a list of parent Objects to this Object.
This Object will also be added as a child to each of the parents.
Relationship cycles are not permitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parents |
List[Object]
|
A list of parent :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_properties(properties)
¶
Method that adds a list of Property values to this Object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
properties |
List[Property]
|
A list of :class: |
required |
Source code in lib/python/src/aria/ops/object.py
add_property(property_)
¶
Method that adds a single Property value to this Object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_ |
Property
|
A :class: |
required |
Source code in lib/python/src/aria/ops/object.py
get_children()
¶
get_identifier_value(identifier_key, default_value=None)
¶
Retrieve the value of a given identifier
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier_key |
str
|
Key of the identifier |
required |
default_value |
str
|
An optional default value |
None
|
Returns:
Type | Description |
---|---|
Optional[str]
|
The value associated with the identifier. |
Optional[str]
|
If the value associated with the identifier is empty and 'default_value' is |
Optional[str]
|
provided, returns 'default_value'. |
Optional[str]
|
If the identifier does not exist, returns default_value if provided, else 'None'. |
Source code in lib/python/src/aria/ops/object.py
get_json()
¶
Get a JSON representation of this Object
Returns a JSON representation of this Object in the format required by vROps.
Returns:
Type | Description |
---|---|
dict
|
A JSON representation of this Object |
Source code in lib/python/src/aria/ops/object.py
get_key()
¶
Get a copy of the Object's Key.
An object's Key cannot change after it has been created.
Returns:
Type | Description |
---|---|
Key
|
A copy of the object's key. |
get_last_metric_value(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str)
|
Metric key of the metric to return. |
required |
Returns:
Type | Description |
---|---|
Optional[float]
|
The latest value of the metric or None if no metric exists with the given key. |
Source code in lib/python/src/aria/ops/object.py
get_last_property_value(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Property key of the property to return. |
required |
Returns:
Type | Description |
---|---|
Optional[str | float]
|
The latest value of the property or None if no property exists with the given key. |
Source code in lib/python/src/aria/ops/object.py
get_metric(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Metric key of the metric to return. |
required |
Returns:
Type | Description |
---|---|
List[Metric]
|
All metrics matching the given key. |
Source code in lib/python/src/aria/ops/object.py
get_metric_values(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Metric key of the metric to return. |
required |
Returns (List[float]): A list of the metric values in chronological order.
Source code in lib/python/src/aria/ops/object.py
get_parents()
¶
get_property(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Property key of the property to return. |
required |
Returns:
Type | Description |
---|---|
List[Property]
|
All properties matching the given key |
Source code in lib/python/src/aria/ops/object.py
get_property_values(key)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Property key of the property to return. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
A list of the property values in chronological order. |
Source code in lib/python/src/aria/ops/object.py
has_content()
¶
Returns:
Type | Description |
---|---|
bool
|
True if the object contains any metrics, properties or events; False otherwise. |
object_type()
¶
with_event(*args, **kwargs)
¶
Method that handles creating an :class:Event
, and adding to this Object.
The signature matches :class:Event.__init__
.
with_metric(*args, **kwargs)
¶
Method that handles creating a :class:Metric
data point, and adding to this Object.
The signature matches :class:Metric.__init__
.
Source code in lib/python/src/aria/ops/object.py
with_property(*args, **kwargs)
¶
Method that handles creating a :class:Property
value, and adding to this Object.
The signature matches :class:Property.__init__
.