Initialize service structs

* DCIM
* Tenancy
* IPAM
* Virtualization
* Secret
This commit is contained in:
Kalle Carlbark 2021-11-26 13:21:19 +01:00
parent 375dc521dc
commit c578285a05
No known key found for this signature in database

View file

@ -21,6 +21,7 @@ type DCIM struct {
Devices *DevicesService Devices *DevicesService
DeviceRoles *DeviceRolesService DeviceRoles *DeviceRolesService
DeviceTypes *DeviceTypesService DeviceTypes *DeviceTypesService
Interfaces *InterfacesService
InventoryItems *InventoryItemsService InventoryItems *InventoryItemsService
RearPorts *RearPortsService RearPorts *RearPortsService
} }
@ -54,21 +55,21 @@ type Client struct {
Virtualization *Virtualization Virtualization *Virtualization
Secret *Secret Secret *Secret
Tenants *TenantsService // Tenants *TenantsService
Sites *SitesService // Sites *SitesService
SiteGroups *SiteGroupsService // SiteGroups *SiteGroupsService
VirtualMachines *VirtualMachinesService // VirtualMachines *VirtualMachinesService
Clusters *ClustersService // Clusters *ClustersService
VLANs *VLANsService // VLANs *VLANsService
Secrets *SecretsService // Secrets *SecretsService
InventoryItems *InventoryItemsService // InventoryItems *InventoryItemsService
Devices *DevicesService // Devices *DevicesService
DeviceRoles *DeviceRolesService // DeviceRoles *DeviceRolesService
DeviceTypes *DeviceTypesService // DeviceTypes *DeviceTypesService
Interfaces *InterfacesService // Interfaces *InterfacesService
Prefixes *PrefixesService // Prefixes *PrefixesService
VRFs *VRFsService // VRFs *VRFsService
RearPorts *RearPortsService // RearPorts *RearPortsService
// baseURL is the URL used for the base URL of the API // baseURL is the URL used for the base URL of the API
baseURL *url.URL baseURL *url.URL
@ -85,17 +86,17 @@ type Client struct {
// Token is set for authentication of the API // Token is set for authentication of the API
Token string Token string
// Debug enables verbose debugging messages to console.
Debug bool
// InsecureSkipVerify is used to selectively skip InsecureVerifications
InsecureSkipVerify bool
// SessionKey is used to read authentication data // SessionKey is used to read authentication data
SessionKey string SessionKey string
// Used by golang wasm // Used by golang wasm
FetchMode string FetchMode string
// Debug enables verbose debugging messages to console.
Debug bool
// InsecureSkipVerify is used to selectively skip InsecureVerifications
InsecureSkipVerify bool
} }
type service struct { type service struct {
@ -144,21 +145,21 @@ func NewClient(apiurl string, httpClient *http.Client) (*Client, error) {
} }
c.common.client = c c.common.client = c
c.Clusters = (*ClustersService)(&c.common) c.Virtualization.Clusters = (*ClustersService)(&c.common)
c.Devices = (*DevicesService)(&c.common) c.DCIM.Devices = (*DevicesService)(&c.common)
c.DeviceRoles = (*DeviceRolesService)(&c.common) c.DCIM.DeviceRoles = (*DeviceRolesService)(&c.common)
c.DeviceTypes = (*DeviceTypesService)(&c.common) c.DCIM.DeviceTypes = (*DeviceTypesService)(&c.common)
c.Interfaces = (*InterfacesService)(&c.common) c.DCIM.Interfaces = (*InterfacesService)(&c.common)
c.InventoryItems = (*InventoryItemsService)(&c.common) c.DCIM.InventoryItems = (*InventoryItemsService)(&c.common)
c.Prefixes = (*PrefixesService)(&c.common) c.IPAM.Prefixes = (*PrefixesService)(&c.common)
c.RearPorts = (*RearPortsService)(&c.common) c.DCIM.RearPorts = (*RearPortsService)(&c.common)
c.Tenants = (*TenantsService)(&c.common) c.Tenancy.Tenants = (*TenantsService)(&c.common)
c.Secrets = (*SecretsService)(&c.common) c.Secret.Secrets = (*SecretsService)(&c.common)
c.Sites = (*SitesService)(&c.common) c.Tenancy.Sites = (*SitesService)(&c.common)
c.SiteGroups = (*SiteGroupsService)(&c.common) c.Tenancy.SiteGroups = (*SiteGroupsService)(&c.common)
c.VirtualMachines = (*VirtualMachinesService)(&c.common) c.Virtualization.VirtualMachines = (*VirtualMachinesService)(&c.common)
c.VLANs = (*VLANsService)(&c.common) c.IPAM.VLANs = (*VLANsService)(&c.common)
c.VRFs = (*VRFsService)(&c.common) c.IPAM.VRFs = (*VRFsService)(&c.common)
return c, nil return c, nil
} }