Netbox GrapQL Inventory Task¤
task api name:
graphql
GrapQL Sample Usage¤
NORFAB Netbox GrapQL Command Shell Reference¤
NorFab shell supports these command options for Netbox graphql
task:
Python API Reference¤
Function to query Netbox v3 or Netbox v4 GraphQL API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
Job
|
NorFab Job object containing relevant metadata |
required |
instance
|
Union[None, str]
|
Netbox instance name |
None
|
dry_run
|
bool
|
only return query content, do not run it |
False
|
obj
|
Union[str, dict]
|
Object to query |
None
|
filters
|
Union[None, dict, str]
|
Filters to apply to the query |
None
|
fields
|
Union[None, list]
|
Fields to retrieve in the query |
None
|
queries
|
Union[None, dict]
|
Dictionary of queries to execute |
None
|
query_string
|
str
|
Raw query string to execute |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Result
|
GraphQL request data returned by Netbox |
Raises:
Type | Description |
---|---|
RuntimeError
|
If required arguments are not provided |
Exception
|
If GraphQL query fails |
Source code in norfab\workers\netbox_worker.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
|