Documentation
¶
Index ¶
- type APIResponse
- type Device
- type DeviceInfo
- type Domain
- type EtherChannelInterface
- type EtherChannelInterfaceInfo
- type FMCClient
- func (fmcc FMCClient) Authenticate() (string, string, error)
- func (fmcc *FMCClient) GetDeviceEtherChannelInterfaces(domainUUID string, deviceID string) ([]EtherChannelInterface, error)
- func (fmcc *FMCClient) GetDeviceInfo(domainUUID string, deviceID string) (*DeviceInfo, error)
- func (fmcc *FMCClient) GetDevicePhysicalInterfaces(domainUUID string, deviceID string) ([]PhysicalInterface, error)
- func (fmcc *FMCClient) GetDeviceSubInterfaces(domainUUID string, deviceID string) ([]SubInterface, error)
- func (fmcc *FMCClient) GetDeviceVLANInterfaces(domainUUID string, deviceID string) ([]VlanInterface, error)
- func (fmcc *FMCClient) GetDevices(domainUUID string) ([]Device, error)
- func (fmcc *FMCClient) GetDomains() ([]Domain, error)
- func (fmcc *FMCClient) GetEtherChannelInterfaceInfo(domainUUID string, deviceID string, interfaceID string) (*EtherChannelInterfaceInfo, error)
- func (fmcc *FMCClient) GetPhysicalInterfaceInfo(domainUUID string, deviceID string, interfaceID string) (*PhysicalInterfaceInfo, error)
- func (fmcc *FMCClient) GetSubInterfaceInfo(domainUUID string, deviceID string, interfaceID string) (*SubInterfaceInfo, error)
- func (fmcc *FMCClient) GetVLANInterfaceInfo(domainUUID string, deviceID string, interfaceID string) (*VLANInterfaceInfo, error)
- func (fmcc *FMCClient) MakeRequest(ctx context.Context, method, path string, body io.Reader, result interface{}) error
- type InterfaceIPv4
- type LinksResponse
- type PaginationResponse
- type PhysicalInterface
- type PhysicalInterfaceInfo
- type SubInterface
- type SubInterfaceInfo
- type VLANInterfaceInfo
- type VlanInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse[T any] struct { Links LinksResponse `json:"links"` Paging PaginationResponse `json:"paging"` Items []T `json:"items"` }
APIResponse represents the API response.
type DeviceInfo ¶
type DeviceInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Model string `json:"model"`
ModelID string `json:"modelId"`
ModelNumber string `json:"modelNumber"`
SWVersion string `json:"sw_version"`
Hostname string `json:"hostName"`
Metadata struct {
SerialNumber string `json:"deviceSerialNumber"`
InventoryData struct {
CPUCores string `json:"cpuCores"`
CPUType string `json:"cpuType"`
MemoryInMB string `json:"memoryInMB"`
} `json:"inventoryData"`
} `json:"metadata"`
}
DeviceInfo represents information about a FMC device.
type Domain ¶
type Domain struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Type string `json:"type"`
}
Domain represents a domain in FMC.
type EtherChannelInterface ¶
type EtherChannelInterface struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
}
EtherChannelInterface represents a EtherChannel interface.
type EtherChannelInterfaceInfo ¶
type EtherChannelInterfaceInfo struct {
Type string `json:"type"`
Mode string `json:"mode"`
MTU int `json:"MTU"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Hardware *struct {
Speed string `json:"speed"`
Duplex string `json:"duplex"`
} `json:"hardware"`
SecurityZone *struct {
ID string `json:"id"`
Type string `json:"type"`
} `json:"securityZone"`
IPv4 *InterfaceIPv4 `json:"ipv4"`
IPv6 *struct {
EnableIPv6 bool `json:"enableIPV6"`
} `json:"ipv6"`
}
EtherChannelInterfaceInfo represents information about a EtherChannel interface.
type FMCClient ¶
type FMCClient struct {
HTTPClient *http.Client
BaseURL string
Username string
Password string
AccessToken string
RefreshToken string
DefaultTimeout time.Duration
Logger *logger.Logger
Ctx context.Context
}
func NewFMCClient ¶
func NewFMCClient( context context.Context, username string, password string, httpScheme string, hostname string, port int, httpClient *http.Client, logger *logger.Logger, ) (*FMCClient, error)
NewFMCClient creates a new FMC client with the given parameters. It authenticates to the FMC API and stores the access and refresh tokens.
func (FMCClient) Authenticate ¶
Authenticate performs authentication on FMC API. If successful it returns access and refresh tokens.
func (*FMCClient) GetDeviceEtherChannelInterfaces ¶
func (fmcc *FMCClient) GetDeviceEtherChannelInterfaces( domainUUID string, deviceID string, ) ([]EtherChannelInterface, error)
func (*FMCClient) GetDeviceInfo ¶
func (fmcc *FMCClient) GetDeviceInfo(domainUUID string, deviceID string) (*DeviceInfo, error)
func (*FMCClient) GetDevicePhysicalInterfaces ¶
func (fmcc *FMCClient) GetDevicePhysicalInterfaces( domainUUID string, deviceID string, ) ([]PhysicalInterface, error)
GetDevicePhysicalInterfaces returns a list of physical interfaces for the specified device in the specified domain.
func (*FMCClient) GetDeviceSubInterfaces ¶
func (fmcc *FMCClient) GetDeviceSubInterfaces( domainUUID string, deviceID string, ) ([]SubInterface, error)
func (*FMCClient) GetDeviceVLANInterfaces ¶
func (fmcc *FMCClient) GetDeviceVLANInterfaces( domainUUID string, deviceID string, ) ([]VlanInterface, error)
func (*FMCClient) GetDevices ¶
GetDevices returns a list of devices from the FMC API for the specified domain.
func (*FMCClient) GetDomains ¶
GetDomains returns a list of domains from the FMC API. It sends a GET request to the /fmc_platform/v1/info/domain endpoint.
func (*FMCClient) GetEtherChannelInterfaceInfo ¶
func (*FMCClient) GetPhysicalInterfaceInfo ¶
func (*FMCClient) GetSubInterfaceInfo ¶
func (*FMCClient) GetVLANInterfaceInfo ¶
func (*FMCClient) MakeRequest ¶
func (fmcc *FMCClient) MakeRequest( ctx context.Context, method, path string, body io.Reader, result interface{}, ) error
MakeRequest sends an HTTP request to the specified path using the given method and body. It retries the request with exponential backoff up to a maximum number of attempts. If the request fails after the maximum number of attempts, it returns an error.
type InterfaceIPv4 ¶
type LinksResponse ¶
type LinksResponse struct {
Self string `json:"self"`
}
LinksResponse represents the links in the API response.
type PaginationResponse ¶
type PaginationResponse struct {
Offset int `json:"offset"`
Limit int `json:"limit"`
Count int `json:"count"`
Pages int `json:"pages"`
}
PaginationResponse represents the paging information in the API response.
type PhysicalInterface ¶
type PhysicalInterface struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
}
PhysicalInterface represents a physical interface.
type PhysicalInterfaceInfo ¶
type PhysicalInterfaceInfo struct {
Type string `json:"type"`
MTU int `json:"MTU"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
ID string `json:"id"`
Mode string `json:"mode"`
Description string `json:"description"`
Hardware *struct {
Speed string `json:"speed"`
Duplex string `json:"duplex"`
} `json:"hardware"`
SecurityZone *struct {
ID string `json:"id"`
Type string `json:"type"`
} `json:"securityZone"`
IPv4 *InterfaceIPv4 `json:"ipv4"`
IPv6 *struct {
EnableIPv6 bool `json:"enableIPV6"`
} `json:"ipv6"`
}
PhysicalInterfaceInfo represents information about a physical interface.
type SubInterface ¶
type SubInterface struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
}
SubInterface represents a sub interface.
type SubInterfaceInfo ¶
type SubInterfaceInfo struct {
Type string `json:"type"`
Mode string `json:"mode"`
MTU int `json:"MTU"`
Enabled bool `json:"enabled"`
Name string `json:"ifname"`
ParentName string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
VlanID int `json:"vlanId"`
SubIntfID int `json:"subIntfId"`
Hardware *struct {
Speed string `json:"speed"`
Duplex string `json:"duplex"`
} `json:"hardware"`
SecurityZone *struct {
ID string `json:"id"`
Type string `json:"type"`
} `json:"securityZone"`
IPv4 *InterfaceIPv4 `json:"ipv4"`
IPv6 *struct {
EnableIPv6 bool `json:"enableIPV6"`
} `json:"ipv6"`
}
type VLANInterfaceInfo ¶
type VLANInterfaceInfo struct {
Type string `json:"type"`
Mode string `json:"mode"`
VID int `json:"vlanId"`
MTU int `json:"MTU"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Hardware *struct {
Speed string `json:"speed"`
Duplex string `json:"duplex"`
} `json:"hardware"`
SecurityZone *struct {
ID string `json:"id"`
Type string `json:"type"`
} `json:"securityZone"`
IPv4 *InterfaceIPv4 `json:"ipv4"`
IPv6 *struct {
EnableIPv6 bool `json:"enableIPV6"`
} `json:"ipv6"`
}
VLANInterfaceInfo represents information about a VLAN interface.
type VlanInterface ¶
type VlanInterface struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
}
VlanInterface represents a VLAN interface.