Documentation ¶
Index ¶
- func GetCertificates(certFile string, keyFile string) (caPool *x509.CertPool, keyPair tls.Certificate)
- type Base
- type ClientConfig
- type Credentials
- type ErrorResp
- type HostConfig
- type IObjectManager
- type IPObjDel
- type IPObject
- type Network
- type ObjectManager
- func (objMgr *ObjectManager) CreateIPAddress(ipAddr string, macAddr string, subnetAddr string, domain string, org string, ...) (string, error)
- func (objMgr *ObjectManager) CreateNetwork(network Network) (string, error)
- func (objMgr *ObjectManager) CreateSubnet(subnet Subnet) (string, error)
- func (objMgr *ObjectManager) DeleteIPAddress(ip string, subnetAddr string, organization string) error
- func (objMgr *ObjectManager) GetNetwork(ipAddr string, orgName string) (*Network, error)
- func (objMgr *ObjectManager) GetNextFreeIP(subnetAddr string, orgName string) (string, error)
- func (objMgr *ObjectManager) GetSubnet(subnetAddr string, orgName string) (*Subnet, error)
- type Payload
- type RestClient
- type Subnet
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCertificates ¶
func GetCertificates(certFile string, keyFile string) (caPool *x509.CertPool, keyPair tls.Certificate)
GetCertificates reads and prepares certificate files
Types ¶
type Base ¶
type Base struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Organization string `json:"organization_name,omitempty"` OrganizationID int `json:"organization_id,omitempty"` Addr1 int `json:"addr1"` Addr2 int `json:"addr2"` Addr3 int `json:"addr3"` Addr4 int `json:"addr4"` Address string `json:"address,omitempty"` }
Base base object
type ClientConfig ¶
type ClientConfig struct { HostConfig TransportConfig }
ClientConfig hold all config required for creating client
func NewClientConfig ¶
func NewClientConfig(hostConf *HostConfig, certFile string, keyFile string, httpRequestTimeout int, httpPoolConnections int) ClientConfig
NewClientConfig creates new client config
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials houses client keys
type HostConfig ¶
HostConfig holds config for connecting to Ipam Server
type IObjectManager ¶
type IObjectManager interface { CreateNetwork(network Network) (string, error) GetNetwork(ipAddr string, orgName string) (*Network, error) CreateSubnet(subnet Subnet) (string, error) GetSubnet(subnetAddr string, orgName string) (*Subnet, error) GetNextFreeIp(subnetAddr string, orgName string) (string, error) CreateIPAddress(ipAddr string, macAddr string, subnetAddr string, domain string, org string, name string) (string, error) DeleteIPAddress(ip string, subnetAddr string, organization string) error }
IObjectManager defines methods for managing objects
type IPObjDel ¶
type IPObjDel struct { Addresses []string `json:"addressArray,omitempty"` Org string `json:"organization_name,omitempty"` DelRRSChked uint `json:"isDeleterrsChecked"` }
IPObjDel for deleting IP Address
type IPObject ¶
type IPObject struct { Base AllocType int `json:"alloc_type"` Class string `json:"class_code,omitempty"` Domain string `json:"domain_name,omitempty"` SubnetAddr string `json:"subnet_address,omitempty"` UpdateNaA bool `json:"update_ns_a,omitempty"` UpdateNsPtr bool `json:"update_ns_ptr,omitempty"` DynUpdRrsA bool `json:"dyn_update_rrs_a,omitempty"` DynUpdRrsPtr bool `json:"dyn_update_rrs_ptr,omitempty"` DynUpdRrsCName bool `json:"dyn_update_rrs_cname,omitempty"` DynUpdRrsMx bool `json:"dyn_update_rrs_mx,omitempty"` }
IPObject to create IP Address
type Network ¶
type Network struct { Base MaskLen int `json:"mask_length,omitempty"` DMZVisible string `json:"dmzVisible,omitempty"` DNSSecEnable string `json:"dnssec_enable,omitempty"` Discovery string `json:"enable_discovery,omitempty"` }
Network Represents IPV4 network
type ObjectManager ¶
type ObjectManager struct {
Client *RestClient
}
ObjectManager manages all object types
func NewObjectManager ¶
func NewObjectManager(conf HostConfig, key string, cert string, poolSize int, timeout time.Duration) *ObjectManager
NewObjectManager create new instance
func (*ObjectManager) CreateIPAddress ¶
func (objMgr *ObjectManager) CreateIPAddress(ipAddr string, macAddr string, subnetAddr string, domain string, org string, name string) (string, error)
CreateIPAddress creates Ip object
func (*ObjectManager) CreateNetwork ¶
func (objMgr *ObjectManager) CreateNetwork(network Network) (string, error)
CreateNetwork creates new Network
func (*ObjectManager) CreateSubnet ¶
func (objMgr *ObjectManager) CreateSubnet(subnet Subnet) (string, error)
CreateSubnet creates a new Subnet
func (*ObjectManager) DeleteIPAddress ¶
func (objMgr *ObjectManager) DeleteIPAddress(ip string, subnetAddr string, organization string) error
DeleteIPAddress deletes Ip object
func (*ObjectManager) GetNetwork ¶
func (objMgr *ObjectManager) GetNetwork(ipAddr string, orgName string) (*Network, error)
GetNetwork Fetches existing network details
func (*ObjectManager) GetNextFreeIP ¶
func (objMgr *ObjectManager) GetNextFreeIP(subnetAddr string, orgName string) (string, error)
GetNextFreeIP creates a new Subnet
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
RestClient is a HTTP Client
func NewRestClient ¶
func NewRestClient(conf HostConfig, key string, cert string, connPool int, connTimeout time.Duration) *RestClient
NewRestClient returns new Rest Client
func (*RestClient) MakeRequest ¶
func (rc *RestClient) MakeRequest(payload Payload) ([]byte, *ErrorResp)
MakeRequest performs rest call
type Subnet ¶
type Subnet struct { Base MaskLen int `json:"mask_length,omitempty"` RouterAddr string `json:"routerAddress,omitempty"` NetworkAddr string `json:"network_address,omitempty"` PrimaryDomain string `json:"primary_domain,omitempty"` SubnetAddress string `json:"fullAddress,omitempty"` NetworkMask int `json:"network_mask,omitempty"` }
Subnet Represents IPV4 network
type TransportConfig ¶
type TransportConfig struct { CertFile string KeyFile string CertPool *x509.CertPool CertKeyPair tls.Certificate HTTPRequestTimeout time.Duration // in seconds HTTPPoolConnections int }
TransportConfig contains HTTP transport config
func NewTransportConfig ¶
func NewTransportConfig(certFile string, keyFile string, httpRequestTimeout int, httpPoolConnections int) (cfg TransportConfig)
NewTransportConfig creates the transport configuration