7c851b8df5
Terraform/OpenTofu provider wrapping the kea-operator KeaAPI, modelled on
terraform-provider-encapi.
- add kea_subnet and kea_clientclass resources with full CRUD over the
PUT/GET/DELETE /api/v1/{subnets,clientclasses}/{name} contract
- add provider config (endpoint + bearer token, KEA_API_TOKEN fallback);
404 on read removes the resource from state
- add unit tests against httptest mock servers (client, wire round-trip,
type conversions, schemas)
- add Makefile (patch|minor|major + package) and .woodpecker CI mirroring
terraform-provider-encapi; tag release PUTs the zip to the artifactapi
terraform-unkin registry under unkin/kea
Claude-Session: https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT
39 lines
1.6 KiB
Go
39 lines
1.6 KiB
Go
package provider
|
|
|
|
// API wire types, mirroring git.unkin.net/unkin/kea-operator internal/keaapi.
|
|
// They are duplicated here to keep the provider's dependency surface small.
|
|
|
|
type optionDataAPI struct {
|
|
Name string `json:"name,omitempty"`
|
|
Code int `json:"code,omitempty"`
|
|
Space string `json:"space,omitempty"`
|
|
Data string `json:"data"`
|
|
}
|
|
|
|
type subnetAPI struct {
|
|
Name string `json:"name"`
|
|
ClusterRef string `json:"cluster_ref,omitempty"`
|
|
Subnet string `json:"subnet"`
|
|
ID int `json:"id,omitempty"`
|
|
Pools []string `json:"pools,omitempty"`
|
|
Routers []string `json:"routers,omitempty"`
|
|
DNSServers []string `json:"dns_servers,omitempty"`
|
|
DomainName string `json:"domain_name,omitempty"`
|
|
NextServer string `json:"next_server,omitempty"`
|
|
BootFileName string `json:"boot_file_name,omitempty"`
|
|
ClientClasses []string `json:"client_classes,omitempty"`
|
|
ValidLifetime int `json:"valid_lifetime,omitempty"`
|
|
OptionData []optionDataAPI `json:"option_data,omitempty"`
|
|
}
|
|
|
|
type clientClassAPI struct {
|
|
Name string `json:"name"`
|
|
ClusterRef string `json:"cluster_ref,omitempty"`
|
|
Test string `json:"test,omitempty"`
|
|
ArchHex []string `json:"arch_hex,omitempty"`
|
|
BootFileName string `json:"boot_file_name,omitempty"`
|
|
NextServer string `json:"next_server,omitempty"`
|
|
ServerHostname string `json:"server_hostname,omitempty"`
|
|
OptionData []optionDataAPI `json:"option_data,omitempty"`
|
|
}
|