Module pyinventory.api.port_type

Functions

def add_equipment_port_type(client: SymphonyClient, name: str, properties: List[PropertyDefinition], link_properties: List[PropertyDefinition]) -> EquipmentPortType

This function creates an equipment port type.

Args

name : str
equipment port type name
properties
(List[ pyinventory.common.data_class.PropertyDefinition ]): list of property definitions
link_properties
(List[ pyinventory.common.data_class.PropertyDefinition ]): list of property definitions

Returns

EquipmentPortType object

Raises

FailedOperationException
internal inventory error

Example

from pyinventory.common.data_class import PropertyDefinition
from pyinventory.graphql.property_kind_enum import PropertyKind
port_type1 = client.add_equipment_port_type(
    name="port type 1",
    properties=[PropertyDefinition(
        property_name="port property",
        property_kind=PropertyKind.string,
        default_value=None,
        is_fixed=True)],
    link_properties=[PropertyDefinition(
        property_name="link port property",
        property_kind=PropertyKind.string,
        default_value=None,
        is_fixed=True)],
)
def delete_equipment_port_type(client: SymphonyClient, equipment_port_type_id: str) -> NoneType

This function deletes an equipment port type. It can get only the requested equipment port type ID

Args

equipment_port_type_id : str
equipment port type ID

Example

client.delete_equipment_port_type(equipment_port_type_id=port_type1.id)
def edit_equipment_port_type(client: SymphonyClient, port_type: EquipmentPortType, new_name: Union[str, NoneType] = None, new_properties: Union[Dict[str, Union[datetime.date, float, int, str, bool, Tuple[float, float]]], NoneType] = None, new_link_properties: Union[Dict[str, Union[datetime.date, float, int, str, bool, Tuple[float, float]]], NoneType] = None) -> EquipmentPortType

This function edits an existing equipment port type.

Args

port_type ( EquipmentPortType ): existing eqipment port type object
new_name : str
new name
new_properties
(Dict[str, PropertyValue]): dictionary
  • str - property type name
  • PropertyValue - new value of the same type for this property
new_link_properties
(Dict[str, PropertyValue]): dictionary
  • str - link property type name
  • PropertyValue - new value of the same type for this link property

Returns

EquipmentPortType object

Raises

FailedOperationException
internal inventory error

Example

port_type1 = client.edit_equipment_port_type(
    port_type=equipment_port_type,
    new_name="new port type name",
    new_properties={"existing property name": "new value"},
    new_link_properties={"existing link property name": "new value"},
)
def get_equipment_port_type(client: SymphonyClient, equipment_port_type_id: str) -> EquipmentPortType

This function returns an equipment port type. It can get only the requested equipment port type ID

Args

equipment_port_type_id : str
equipment port type ID

Returns

EquipmentPortType object

Raises

EntityNotFoundError: equipment port type does not found

Example

port_type = client.get_equipment_port_type(equipment_port_type_id=port_type1.id)