-
Notifications
You must be signed in to change notification settings - Fork 1
chore: entity docs #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6f74083
initial docs generation docs
paulstuart dd23c63
updated with generated entitities examples
paulstuart 14fe374
fix PR feedback
paulstuart d08d785
ensure latest tag used for sdk reference, restore the directive for …
paulstuart e27d6a6
update the correct branch
paulstuart 102de6e
new entities
paulstuart 21516e0
fix device_config examples
paulstuart adc6248
Merge branch 'develop' into chore/OBS-1867-entity-generation
paulstuart df95eac
finally, just use latest diode-sdk-go in examples
paulstuart 7c0c906
more complete examples
paulstuart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| # Diode Go SDK - Entity Examples | ||
|
|
||
| Source: NetBox v4.5.0 | ||
| Generated: 2026-02-02 21:20:55Z | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Go 1.23 or later | ||
| - Diode SDK for Go | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| go get github.com/netboxlabs/diode-sdk-go@v0.1.0 | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| Each example uses constants for configuration. You can modify these in the example code: | ||
|
|
||
| ```go | ||
| target = "grpc://localhost:8080/diode" | ||
| appName = "example-app" | ||
| appVersion = "1.0.0" | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Each entity example is in its own directory with a complete Go module. To run an example: | ||
|
|
||
| ```bash | ||
| cd examples/device | ||
| go run main.go | ||
| ``` | ||
|
|
||
| ## Example Patterns | ||
|
|
||
| Each example includes three patterns: | ||
|
|
||
| - **Minimal**: Only required fields | ||
| - **Extended**: Required fields plus common optional fields | ||
| - **Explicit**: Fully nested objects with all common fields | ||
|
|
||
| Switch between patterns by uncommenting the desired function call in `main()`. | ||
|
jajeffries marked this conversation as resolved.
|
||
|
|
||
| ## Available Entity Examples | ||
|
|
||
| ### Circuits | ||
|
|
||
| - [Circuit](examples/circuit/) | ||
| - [CircuitGroup](examples/circuit_group/) | ||
| - [CircuitGroupAssignment](examples/circuit_group_assignment/) | ||
| - [CircuitTermination](examples/circuit_termination/) | ||
| - [CircuitType](examples/circuit_type/) | ||
| - [Provider](examples/provider/) | ||
| - [ProviderAccount](examples/provider_account/) | ||
| - [ProviderNetwork](examples/provider_network/) | ||
| - [VirtualCircuit](examples/virtual_circuit/) | ||
| - [VirtualCircuitTermination](examples/virtual_circuit_termination/) | ||
| - [VirtualCircuitType](examples/virtual_circuit_type/) | ||
|
|
||
| ### DCIM | ||
|
|
||
| - [Cable](examples/cable/) | ||
| - [CablePath](examples/cable_path/) | ||
| - [ConsolePort](examples/console_port/) | ||
| - [ConsoleServerPort](examples/console_server_port/) | ||
| - [Device](examples/device/) | ||
| - [DeviceBay](examples/device_bay/) | ||
| - [DeviceRole](examples/device_role/) | ||
| - [DeviceType](examples/device_type/) | ||
| - [FrontPort](examples/front_port/) | ||
| - [Interface](examples/interface_entity/) | ||
| - [InventoryItem](examples/inventory_item/) | ||
| - [InventoryItemRole](examples/inventory_item_role/) | ||
| - [Location](examples/location/) | ||
| - [Manufacturer](examples/manufacturer/) | ||
| - [Module](examples/module/) | ||
| - [ModuleBay](examples/module_bay/) | ||
| - [ModuleType](examples/module_type/) | ||
| - [ModuleTypeProfile](examples/module_type_profile/) | ||
| - [Platform](examples/platform/) | ||
| - [PowerFeed](examples/power_feed/) | ||
| - [PowerOutlet](examples/power_outlet/) | ||
| - [PowerPanel](examples/power_panel/) | ||
| - [PowerPort](examples/power_port/) | ||
| - [Rack](examples/rack/) | ||
| - [RackReservation](examples/rack_reservation/) | ||
| - [RackRole](examples/rack_role/) | ||
| - [RackType](examples/rack_type/) | ||
| - [RearPort](examples/rear_port/) | ||
| - [Region](examples/region/) | ||
| - [Site](examples/site/) | ||
| - [SiteGroup](examples/site_group/) | ||
| - [VirtualChassis](examples/virtual_chassis/) | ||
| - [VirtualDeviceContext](examples/virtual_device_context/) | ||
|
|
||
| ### Extras | ||
|
|
||
| - [CustomField](examples/custom_field/) | ||
| - [CustomFieldChoiceSet](examples/custom_field_choice_set/) | ||
| - [CustomLink](examples/custom_link/) | ||
| - [JournalEntry](examples/journal_entry/) | ||
| - [Tag](examples/tag/) | ||
|
|
||
| ### IPAM | ||
|
|
||
| - [ASN](examples/asn/) | ||
| - [ASNRange](examples/asn_range/) | ||
| - [Aggregate](examples/aggregate/) | ||
| - [FHRPGroup](examples/fhrp_group/) | ||
| - [FHRPGroupAssignment](examples/fhrp_group_assignment/) | ||
| - [IPAddress](examples/ip_address/) | ||
| - [IPRange](examples/ip_range/) | ||
| - [MACAddress](examples/mac_address/) | ||
| - [Prefix](examples/prefix/) | ||
| - [RIR](examples/rir/) | ||
| - [Role](examples/role/) | ||
| - [RouteTarget](examples/route_target/) | ||
| - [Service](examples/service/) | ||
| - [VLAN](examples/vlan/) | ||
| - [VLANGroup](examples/vlan_group/) | ||
| - [VLANTranslationPolicy](examples/vlan_translation_policy/) | ||
| - [VLANTranslationRule](examples/vlan_translation_rule/) | ||
| - [VRF](examples/vrf/) | ||
|
|
||
| ### Tenancy | ||
|
|
||
| - [Contact](examples/contact/) | ||
| - [ContactAssignment](examples/contact_assignment/) | ||
| - [ContactGroup](examples/contact_group/) | ||
| - [ContactRole](examples/contact_role/) | ||
| - [Owner](examples/owner/) | ||
| - [OwnerGroup](examples/owner_group/) | ||
| - [Tenant](examples/tenant/) | ||
| - [TenantGroup](examples/tenant_group/) | ||
|
|
||
| ### VPN | ||
|
|
||
| - [IKEPolicy](examples/ike_policy/) | ||
| - [IKEProposal](examples/ike_proposal/) | ||
| - [IPSecPolicy](examples/ip_sec_policy/) | ||
| - [IPSecProfile](examples/ip_sec_profile/) | ||
| - [IPSecProposal](examples/ip_sec_proposal/) | ||
| - [L2VPN](examples/l2vpn/) | ||
| - [L2VPNTermination](examples/l2vpn_termination/) | ||
| - [Tunnel](examples/tunnel/) | ||
| - [TunnelGroup](examples/tunnel_group/) | ||
| - [TunnelTermination](examples/tunnel_termination/) | ||
|
|
||
| ### Virtualization | ||
|
|
||
| - [Cluster](examples/cluster/) | ||
| - [ClusterGroup](examples/cluster_group/) | ||
| - [ClusterType](examples/cluster_type/) | ||
| - [VMInterface](examples/vm_interface/) | ||
| - [VirtualDisk](examples/virtual_disk/) | ||
| - [VirtualMachine](examples/virtual_machine/) | ||
|
|
||
| ### Wireless | ||
|
|
||
| - [WirelessLAN](examples/wireless_lan/) | ||
| - [WirelessLANGroup](examples/wireless_lan_group/) | ||
| - [WirelessLink](examples/wireless_link/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module aggregate | ||
|
|
||
| go 1.23 | ||
|
mfiedorowicz marked this conversation as resolved.
Outdated
|
||
|
|
||
| require github.com/netboxlabs/diode-sdk-go v0.1.0 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // Package main demonstrates ingesting Aggregate entities using the Diode SDK. | ||
| // This example includes three patterns: Minimal, Extended, and Explicit. | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "log" | ||
|
|
||
| "github.com/netboxlabs/diode-sdk-go/diode" | ||
| ) | ||
|
|
||
| const ( | ||
| target = "grpc://localhost:8080/diode" | ||
|
jajeffries marked this conversation as resolved.
|
||
| appName = "aggregate-example" | ||
| appVersion = "1.0.0" | ||
| ) | ||
|
|
||
| func main() { | ||
| client, err := diode.NewClient( | ||
| target, | ||
| appName, | ||
| appVersion, | ||
| ) | ||
| if err != nil { | ||
| log.Fatalf("Failed to create client: %v", err) | ||
| } | ||
|
|
||
| // Choose one of the three patterns by uncommenting: | ||
| aggregate := AggregateMinimal() | ||
| // aggregate := AggregateExtended() | ||
| // aggregate := AggregateExplicit() | ||
|
|
||
| resp, err := client.Ingest(context.Background(), []diode.Entity{aggregate}) | ||
| if err != nil { | ||
| log.Fatalf("Ingestion failed: %v", err) | ||
| } | ||
| if resp.Errors != nil { | ||
| log.Printf("Errors: %v", resp.Errors) | ||
| } else { | ||
| log.Println("Aggregate ingested successfully") | ||
| } | ||
| } | ||
|
|
||
| // AggregateMinimal Creates a Aggregate with only required fields. | ||
| func AggregateMinimal() *diode.Aggregate { | ||
| return &diode.Aggregate{ | ||
| Prefix: diode.String("192.0.2.0/24"), | ||
| Rir: &diode.RIR{ | ||
| Name: diode.String("Example Name"), | ||
| Slug: diode.String("example-slug"), | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| // AggregateExtended Creates a Aggregate with common optional fields. | ||
| func AggregateExtended() *diode.Aggregate { | ||
| return &diode.Aggregate{ | ||
| Prefix: diode.String("192.0.2.0/24"), | ||
| Rir: &diode.RIR{ | ||
| Name: diode.String("Example Name"), | ||
| Slug: diode.String("example-slug"), | ||
| }, | ||
| Description: diode.String("Example description"), | ||
| } | ||
| } | ||
|
|
||
| // AggregateExplicit Creates a Aggregate with fully nested objects and all common fields. | ||
| func AggregateExplicit() *diode.Aggregate { | ||
| return &diode.Aggregate{ | ||
| Prefix: diode.String("192.0.2.0/24"), | ||
| Rir: &diode.RIR{ | ||
| Name: diode.String("Example Name"), | ||
| Slug: diode.String("example-slug"), | ||
| }, | ||
| Description: diode.String("Example description"), | ||
| Comments: diode.String("Example comments"), | ||
| Tenant: &diode.Tenant{ | ||
| Name: diode.String("Example Name"), | ||
| Slug: diode.String("example-slug"), | ||
| }, | ||
| Tags: []*diode.Tag{{Name: diode.String("production")}}, | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module asn | ||
|
|
||
| go 1.23 | ||
|
|
||
| require github.com/netboxlabs/diode-sdk-go v0.1.0 | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.