Documentation
¶
Overview ¶
Package addresses provides types and methods for working with the addresses controller.
Index ¶
- type Address
- type Controller
- func (c *Controller) CreateAddress(in Address) (message string, err error)
- func (c *Controller) CreateFirstFreeAddress(id int, in Address) (out string, err error)
- func (c *Controller) DeleteAddress(id int, RemoveDNS phpipam.BoolIntString) (message string, err error)
- func (c *Controller) GetAddressByID(id int) (out Address, err error)
- func (c *Controller) GetAddressCustomFields(id int) (out map[string]interface{}, err error)
- func (c *Controller) GetAddressCustomFieldsSchema() (out map[string]phpipam.CustomField, err error)
- func (c *Controller) GetAddressesByIP(ipaddr string) (out []Address, err error)
- func (c *Controller) GetAddressesByIpInSubnet(ipaddr string, subnetID int) (out Address, err error)
- func (c *Controller) UpdateAddress(in Address) (message string, err error)
- func (c *Controller) UpdateAddressCustomFields(id int, in map[string]interface{}) (message string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // The ID of the IP address entry within PHPIPAM. ID int `json:"id,omitempty"` // The ID of the subnet that the address belongs to. SubnetID int `json:"subnetId,omitempty"` // The IP address, without a CIDR subnet mask. IPAddress string `json:"ip,omitempty"` // true if this IP address is a gateway address. IsGateway phpipam.BoolInt `json:"is_gateway,omitempty"` // A detailed description of the IP address entry. Description string `json:"description,omitempty"` // A hostname for the IP address. Hostname string `json:"hostname,omitempty"` // The MAC address for the IP. MACAddress string `json:"mac,omitempty"` // The address owner (customer, hostname, application, etc). Owner string `json:"owner,omitempty"` // The tag ID for the IP address. Tag int `json:"tag,omitempty"` // true if PTR records should not be created for this IP address. PTRIgnore phpipam.BoolInt `json:"PTRIgnore,omitempty"` // The ID of a PowerDNS PTR record. PTRRecordID int `json:"PTR,omitempty"` // An ID of a device that this address belongs to. DeviceID int `json:"deviceId,omitempty"` // A switchport number/label that this IP address belongs to. Port string `json:"port,omitempty"` // A note for this IP address, detailing state information not sutiable for // entering in the description. Note string `json:"note,omitempty"` // A timestamp for when the address was last seen with ping. LastSeen string `json:"lastSeen,omitempty"` // true if you want to exclude this address from ping scans. ExcludePing phpipam.BoolInt `json:"excludePing,omitempty"` // The date of the last edit to this resource. EditDate string `json:"editDate,omitempty"` // A map[string]interface{} of custom fields to set on the resource. Note // that this functionality requires PHPIPAM 1.3 or higher with the "Nest // custom fields" flag set on the specific API integration. If this is not // enabled, this map will be nil on GETs and POSTs and PATCHes with this // field set will fail. Use the explicit custom field functions instead. CustomFields map[string]interface{} `json:"custom_fields,omitempty"` }
Address represents an IP address resource within PHPIPAM.
type Controller ¶
Controller is the base client for the Addresses controller.
func NewController ¶
func NewController(sess *session.Session) *Controller
NewController returns a new instance of the client for the Addresses controller.
func (*Controller) CreateAddress ¶
func (c *Controller) CreateAddress(in Address) (message string, err error)
CreateAddress creates an address by sending a POST request.
func (*Controller) CreateFirstFreeAddress ¶
func (c *Controller) CreateFirstFreeAddress(id int, in Address) (out string, err error)
CreateAddress creates a first free in subnet address by sending a POST request.
func (*Controller) DeleteAddress ¶
func (c *Controller) DeleteAddress(id int, RemoveDNS phpipam.BoolIntString) (message string, err error)
DeleteAddress deletes an address by ID. RemoveDNS can be set to true if you want to have any related DNS records deleted as well.
func (*Controller) GetAddressByID ¶
func (c *Controller) GetAddressByID(id int) (out Address, err error)
GetAddressByID GETs an address via its ID.
func (*Controller) GetAddressCustomFields ¶
func (c *Controller) GetAddressCustomFields(id int) (out map[string]interface{}, err error)
GetAddressCustomFields GETs the custom fields for a subnet via client.GetCustomFields.
func (*Controller) GetAddressCustomFieldsSchema ¶
func (c *Controller) GetAddressCustomFieldsSchema() (out map[string]phpipam.CustomField, err error)
GetAddressCustomFieldsSchema GETs the custom fields for the addresses controller via client.GetCustomFieldsSchema.
func (*Controller) GetAddressesByIP ¶
func (c *Controller) GetAddressesByIP(ipaddr string) (out []Address, err error)
GetAddressesByIP searches for an address by its IP.
According to the spec, this can return multiple addresses, however it's not entirely clear how to perform a search that would yield multiple results.
func (*Controller) GetAddressesByIpInSubnet ¶
func (c *Controller) GetAddressesByIpInSubnet(ipaddr string, subnetID int) (out Address, err error)
GetAddressesByIP searches for an address by its IP with in given subnet When having multiple subnets with same ip range this will return the address in the given subnet Those subnet may not talk to each other but still exist under on phpIPAM instance especially on ones migrated from previous versions
func (*Controller) UpdateAddress ¶
func (c *Controller) UpdateAddress(in Address) (message string, err error)
UpdateAddress updates an address by sending a PATCH request.
func (*Controller) UpdateAddressCustomFields ¶
func (c *Controller) UpdateAddressCustomFields(id int, in map[string]interface{}) (message string, err error)
UpdateAddressCustomFields PATCHes the subnet's custom fields via client.UpdateCustomFields.