Skip to content
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

feat: Support querying sites by facility #483

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

Ikke
Copy link
Contributor

@Ikke Ikke commented Oct 10, 2023

Add support for the facility field to the site datasource so that it can be used to find sites by facility if it's unique, or retrieve the facility for a site.

Add support for the facility field to the site datasource so that it can
be used to find sites by facility if it's unique, or retrieve the
facility for a site.
@fbreckle
Copy link
Collaborator

fbreckle commented Oct 10, 2023

I was wondering if the attribute name should be facility_id, but the description of the attribute is somewhat fuzzy in https://github.com/fbreckle/go-netbox/blob/master/netbox/models/site.go#L72C37-L72C37

	// Local facility ID or description
	// Max Length: 50
	Facility string `json:"facility,omitempty"`

Can this really be ID OR description? 🤔

@Ikke
Copy link
Contributor Author

Ikke commented Oct 10, 2023

Seems like that's incorrect in the netbox documentation. The field is just a string, not a reference to an object (there is no facility entity).

https://demo.netbox.dev/api/dcim/sites/?facility=DSW returns

{
   "id": 22,
   "url": "https://demo.netbox.dev/api/dcim/sites/22/",
   "display": "D. S. Weaver Labs",
   "name": "D. S. Weaver Labs",
   [..],
   "facility": "DSW",
}

@fbreckle fbreckle merged commit 1f19bb5 into e-breuninger:master Oct 10, 2023
9 checks passed
@Ikke Ikke deleted the datasource-site-facility branch November 30, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants