### Example Configuration JSON for Import Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/install/_index.md An example JSON structure for importing configurations into Gravity, showing key-value pairs for cluster settings. ```json {"entries": [{"key": "/gravity/foo","value": "Zm9v"}]} ``` -------------------------------- ### Importing Configurations via Environment Variable Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/install/_index.md Demonstrates how to use the IMPORT_CONFIGS environment variable to load configurations on Gravity's first startup. It shows examples for importing from file URIs and using base64 encoded configurations. ```bash IMPORT_CONFIGS=file:///config.json # Multiple configs IMPORT_CONFIGS=file:///configA.json|file:///configB.json # Base64 import IMPORT_CONFIGS=eyJlbnRyaWVzIjogW3sia2V5IjogIi9ncmF2aXR5L2ZvbyIsInZhbHVlIjogIlptOXYifV19 ``` -------------------------------- ### Docker Compose for Gravity Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/install/_index.md This Docker Compose configuration sets up a Gravity service with specified hostname, image, restart policy, network mode, and logging options. It also defines a local volume for data persistence. ```yaml --- version: "3.4" services: gravity: # Important for this to be static and unique hostname: gravity1 image: ghcr.io/beryju/gravity:stable restart: unless-stopped network_mode: host volumes: - data:/data # environment: # LOG_LEVEL: info # The default log level of info logs DHCP and DNS queries, so ensure # the logs aren't filling up the disk logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: data: driver: local ``` -------------------------------- ### Go API Client Installation and Usage Source: https://github.com/beryju/gravity/blob/main/api/README.md Instructions for installing the Go API client for the Gravity API, including necessary dependencies and import statements. Demonstrates how to set environment variables for proxy configuration and how to use context for server URL selection and templating. ```Shell go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` ```Go import api "beryju.io/gravity/api" ``` ```Go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` ```Go ctx := context.WithValue(context.Background(), api.ContextServerIndex, 1) ``` ```Go ctx := context.WithValue(context.Background(), api.ContextServerVariables, map[string]string{ "basePath": "v2", }) ``` ```Go ctx := context.WithValue(context.Background(), api.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) ctx = context.WithValue(context.Background(), api.ContextOperationServerVariables, map[string]map[string]string{ "{classname}Service.{nickname}": { "port": "8443", }, }) ``` -------------------------------- ### CoreDNS Configuration Example Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/dns/zones.md Provides an example of a CoreDNS configuration in Caddyfile format, which can be used with Gravity. It highlights the importance of using a different port than Gravity's default to avoid conflicts. ```caddy .:1053 { whoami } ``` -------------------------------- ### Go Example - ClusterGetClusterInfo Source: https://github.com/beryju/gravity/blob/main/api/docs/ClusterApi.md Example Go code to call the ClusterGetClusterInfo endpoint using the Gravity API client. Demonstrates configuration, API client instantiation, and handling the response. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ClusterApi.ClusterGetClusterInfo(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ClusterApi.ClusterGetClusterInfo``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ClusterGetClusterInfo`: InstanceAPIClusterInfoOutput fmt.Fprintf(os.Stdout, "Response from `ClusterApi.ClusterGetClusterInfo`: %v\n", resp) } ``` -------------------------------- ### BackupAPIBackupStatusOutput Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/BackupAPIBackupStatusOutput.md Provides methods for creating, getting, and setting the status of a BackupAPIBackupStatusOutput object. Includes constructors and accessor methods. ```APIDOC BackupAPIBackupStatusOutput: Properties: Status: []BackupAPIBackupStatus - Type: []BackupAPIBackupStatus - Description: Represents the status of backups. Methods: NewBackupAPIBackupStatusOutput(status []BackupAPIBackupStatus) *BackupAPIBackupStatusOutput - Description: Instantiates a new BackupAPIBackupStatusOutput object with provided status. - Parameters: - status: A slice of BackupAPIBackupStatus. - Returns: A pointer to BackupAPIBackupStatusOutput. NewBackupAPIBackupStatusOutputWithDefaults() *BackupAPIBackupStatusOutput - Description: Instantiates a new BackupAPIBackupStatusOutput object with default values. - Returns: A pointer to BackupAPIBackupStatusOutput. GetStatus() []BackupAPIBackupStatus - Description: Returns the Status field. - Returns: A slice of BackupAPIBackupStatus. GetStatusOk() (*[]BackupAPIBackupStatus, bool) - Description: Returns the Status field and a boolean indicating if it was set. - Returns: A tuple containing a pointer to the Status field and a boolean. SetStatus(v []BackupAPIBackupStatus) - Description: Sets the Status field to the given value. - Parameters: - v: The []BackupAPIBackupStatus to set. SetStatusNil(b bool) - Description: Sets the Status field to an explicit nil value. - Parameters: - b: Boolean indicating whether to set to nil. UnsetStatus() - Description: Ensures no value is present for the Status field. ``` -------------------------------- ### DiscoverySubnetStart Go Example Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDiscoveryApi.md Demonstrates how to use the DiscoverySubnetStart function from the Gravity API client library in Go. It shows how to set parameters like identifier and wait, execute the request, and handle potential errors. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { identifier := "identifier_example" // string | wait := true // bool | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.RolesDiscoveryApi.DiscoverySubnetStart(context.Background()).Identifier(identifier).Wait(wait).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDiscoveryApi.DiscoverySubnetStart``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` -------------------------------- ### Get Role Configuration API Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesApiApi.md Fetches the API role configuration. This Go example shows how to call the `ApiGetRoleConfig` endpoint and process the returned configuration. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesApiApi.ApiGetRoleConfig(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesApiApi.ApiGetRoleConfig``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ApiGetRoleConfig`: ApiAPIRoleConfigOutput fmt.Fprintf(os.Stdout, "Response from `RolesApiApi.ApiGetRoleConfig`: %v\n", resp) } ``` -------------------------------- ### Updating Environment Variables in Docker Compose Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/install/_index.md Illustrates how to modify or add environment variables within the Docker Compose file to customize Gravity's runtime configuration. ```yaml environment: INSTANCE_IP: 192.168.2.8 BOOTSTRAP_ROLES: dns;api;etcd;discovery;monitoring;tsdb INSTANCE_IDENTIFIER: my-gravity-server ``` -------------------------------- ### Discovery API: Get Role Configuration Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDiscoveryApi.md Fetches the role configuration from the Gravity API. This Go example demonstrates calling the DiscoveryGetRoleConfig endpoint and handling the DiscoveryAPIRoleConfigOutput response. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesDiscoveryApi.DiscoveryGetRoleConfig(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDiscoveryApi.DiscoveryGetRoleConfig``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DiscoveryGetRoleConfig`: DiscoveryAPIRoleConfigOutput fmt.Fprintf(os.Stdout, "Response from `RolesDiscoveryApi.DiscoveryGetRoleConfig`: %v\n", resp) } ``` -------------------------------- ### BackupAPIRoleConfigOutput Structure and Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/BackupAPIRoleConfigOutput.md Provides details on the BackupAPIRoleConfigOutput structure, its properties, and associated methods for instantiation and data access. Includes constructors and getter/setter methods for the 'Config' property. ```APIDOC BackupAPIRoleConfigOutput: Properties: Config: BackupRoleConfig - The configuration for the backup role. Methods: NewBackupAPIRoleConfigOutput(config BackupRoleConfig) *BackupAPIRoleConfigOutput Description: Instantiates a new BackupAPIRoleConfigOutput object with the given configuration. Parameters: config: The BackupRoleConfig to assign. Returns: A pointer to the created BackupAPIRoleConfigOutput object. NewBackupAPIRoleConfigOutputWithDefaults() *BackupAPIRoleConfigOutput Description: Instantiates a new BackupAPIRoleConfigOutput object with default values. Returns: A pointer to the created BackupAPIRoleConfigOutput object. GetConfig() BackupRoleConfig Description: Returns the Config field of the BackupAPIRoleConfigOutput. Returns: The BackupRoleConfig value. GetConfigOk() (*BackupRoleConfig, bool) Description: Returns the Config field and a boolean indicating if it was set. Returns: A tuple containing a pointer to the BackupRoleConfig and a boolean. SetConfig(v BackupRoleConfig) Description: Sets the Config field of the BackupAPIRoleConfigOutput. Parameters: v: The BackupRoleConfig value to set. ``` -------------------------------- ### Gravity Handler Configuration Example Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/dns/zones.md Demonstrates the basic structure for configuring Gravity DNS handlers, showing a list of handler types and their specific settings. ```yaml - type: forward_blocky to: - 8.8.8.8 cache_ttl: 3600 - type: forward_ip to: - 8.8.8.8 ``` ```yaml - type: memory - type: etcd ``` -------------------------------- ### Get Etcd Members (Go) Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesEtcdApi.md Example Go code to retrieve Etcd members using the RolesEtcdApi. It demonstrates how to configure the API client, make the request, and handle the response or errors. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesEtcdApi.EtcdGetMembers(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesEtcdApi.EtcdGetMembers``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `EtcdGetMembers`: EtcdAPIMembersOutput fmt.Fprintf(os.Stdout, "Response from `RolesEtcdApi.EtcdGetMembers`: %v\n", resp) } ``` -------------------------------- ### DHCP Get Role Config Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDhcpApi.md Retrieves the DHCP role configuration. This endpoint requires no authorization and returns a DhcpAPIRoleConfigOutput object. The example demonstrates setting up the API client and executing the request. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesDhcpApi.DhcpGetRoleConfig(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDhcpApi.DhcpGetRoleConfig``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DhcpGetRoleConfig`: DhcpAPIRoleConfigOutput fmt.Fprintf(os.Stdout, "Response from `RolesDhcpApi.DhcpGetRoleConfig`: %v\n", resp) } ``` -------------------------------- ### TFTP Bundled Boot Files Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/tftp/_index.md Gravity includes bundled files for TFTP network booting, accessible via the 'bundled/' prefix. These include UEFI and Legacy boot images for Netboot.xyz and iPXE. ```APIDOC TFTP Bundled Files: - bundled/netboot.xyz.efi: (UEFI) Netboot.xyz DHCP boot image. - bundled/netboot.xyz.kpxe: (Legacy) Netboot.xyz DHCP boot image. - bundled/netboot.xyz-undionly.kpxe: (Legacy) Netboot.xyz DHCP boot image for NIC issues. - bundled/ipxe.efi: (UEFI) iPXE Chain image file. - bundled/ipxe.undionly.kpxe: (Legacy) iPXE Chain image file. ``` -------------------------------- ### Discovery API: Get Devices Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDiscoveryApi.md Retrieves devices using the Gravity API. The Go example shows how to call the DiscoveryGetDevices endpoint, optionally filtering by an identifier, and processing the DiscoveryAPIDevicesGetOutput response. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { identifier := "identifier_example" // string | Optionally get device by identifier (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesDiscoveryApi.DiscoveryGetDevices(context.Background()).Identifier(identifier).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDiscoveryApi.DiscoveryGetDevices``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DiscoveryGetDevices`: DiscoveryAPIDevicesGetOutput fmt.Fprintf(os.Stdout, "Response from `RolesDiscoveryApi.DiscoveryGetDevices`: %v\n", resp) } ``` -------------------------------- ### Start Backup Process Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesBackupApi.md Initiates the backup process. This method can optionally wait for the backup to complete. It accepts a boolean `wait` parameter and returns a BackupBackupStatus object. ```APIDOC BackupStart(ctx).Wait(wait).Execute() Backup start Path Parameters: Other Parameters: Other parameters are passed through a pointer to a apiBackupStartRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **wait** | **bool** | | Return type: [BackupBackupStatus](BackupBackupStatus.md) Authorization: No authorization required ``` ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { wait := true // bool | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesBackupApi.BackupStart(context.Background()).Wait(wait).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesBackupApi.BackupStart``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `BackupStart`: BackupBackupStatus fmt.Fprintf(os.Stdout, "Response from `RolesBackupApi.BackupStart`: %v\n", resp) } ``` -------------------------------- ### TFTP File Management (Delete, Download, Get, Put) Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesTftpApi.md Provides endpoints for managing TFTP files. Includes operations for deleting, downloading, retrieving, and uploading files via TFTP. Examples are shown in Go. ```APIDOC Method | HTTP request | Description ------------- | ------------- | Integrated TftpDeleteFiles | **Delete** /api/v1/tftp/files | TFTP Files TftpDownloadFiles | **Get** /api/v1/tftp/files/download | TFTP Files TftpGetFiles | **Get** /api/v1/tftp/files | TFTP Files TftpPutFiles | **Post** /api/v1/tftp/files | TFTP Files ``` ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { // Example for TftpDeleteFiles host := "host_example" // string | (optional) name := "name_example" // string | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.RolesTftpApi.TftpDeleteFiles(context.Background()).Host(host).Name(name).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesTftpApi.TftpDeleteFiles``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // Example for TftpDownloadFiles respDownload, rDownload, errDownload := apiClient.RolesTftpApi.TftpDownloadFiles(context.Background()).Host(host).Name(name).Execute() if errDownload != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesTftpApi.TftpDownloadFiles``: %v\n", errDownload) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", rDownload) } // response from `TftpDownloadFiles`: TftpAPIFilesDownloadOutput fmt.Fprintf(os.Stdout, "Response from `RolesTftpApi.TftpDownloadFiles`: %v\n", respDownload) // Example for TftpGetFiles respGet, rGet, errGet := apiClient.RolesTftpApi.TftpGetFiles(context.Background()).Execute() if errGet != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesTftpApi.TftpGetFiles``: %v\n", errGet) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", rGet) } // response from `TftpGetFiles`: TftpAPIFilesGetOutput fmt.Fprintf(os.Stdout, "Response from `RolesTftpApi.TftpGetFiles`: %v\n", respGet) // Example for TftpPutFiles (requires request body, not shown here for brevity) // ... } ``` -------------------------------- ### Discovery API Endpoints Source: https://github.com/beryju/gravity/blob/main/api/README.md Provides endpoints for discovering devices and managing discovery role configurations and subnets. Includes operations for getting and putting role configurations, as well as starting subnet discovery. ```APIDOC DiscoveryGetDevices: GET /api/v1/discovery/devices Description: Get discovery devices. ``` ```APIDOC DiscoveryGetRoleConfig: GET /api/v1/roles/discovery Description: Get discovery role config. ``` ```APIDOC DiscoveryGetSubnets: GET /api/v1/discovery/subnets Description: Get discovery subnets. ``` ```APIDOC DiscoveryPutRoleConfig: POST /api/v1/roles/discovery Description: Put discovery role config. ``` ```APIDOC DiscoveryPutSubnets: POST /api/v1/discovery/subnets Description: Put discovery subnets. ``` ```APIDOC DiscoverySubnetStart: POST /api/v1/discovery/subnets/start Description: Start discovery subnets. ``` -------------------------------- ### MonitoringAPIRoleConfigInput API Documentation Source: https://github.com/beryju/gravity/blob/main/api/docs/MonitoringAPIRoleConfigInput.md Provides API documentation for the MonitoringAPIRoleConfigInput structure, covering its properties and methods for instantiation and data manipulation. ```APIDOC MonitoringAPIRoleConfigInput: Properties: Config: MonitoringRoleConfig Description: Configuration for the monitoring role. Methods: NewMonitoringAPIRoleConfigInput(config MonitoringRoleConfig) *MonitoringAPIRoleConfigInput Description: Instantiates a new MonitoringAPIRoleConfigInput object with the given configuration. Parameters: config: The MonitoringRoleConfig to assign. Returns: A pointer to the created MonitoringAPIRoleConfigInput object. NewMonitoringAPIRoleConfigInputWithDefaults() *MonitoringAPIRoleConfigInput Description: Instantiates a new MonitoringAPIRoleConfigInput object with default values. Returns: A pointer to the created MonitoringAPIRoleConfigInput object. GetConfig() MonitoringRoleConfig Description: Retrieves the Config field from the MonitoringAPIRoleConfigInput object. Returns: The MonitoringRoleConfig value. GetConfigOk() (*MonitoringRoleConfig, bool) Description: Retrieves the Config field and a boolean indicating if it was set. Returns: A tuple containing a pointer to the MonitoringRoleConfig and a boolean. SetConfig(v MonitoringRoleConfig) Description: Sets the Config field of the MonitoringAPIRoleConfigInput object. Parameters: v: The MonitoringRoleConfig value to set. ``` -------------------------------- ### DhcpAPILease Constructors Source: https://github.com/beryju/gravity/blob/main/api/docs/DhcpAPILease.md Provides constructors for creating new DhcpAPILease objects. NewDhcpAPILease initializes with required properties, while NewDhcpAPILeaseWithDefaults uses default values. ```Go func NewDhcpAPILease(address string, addressLeaseTime string, description string, hostname string, identifier string, scopeKey string) *DhcpAPILease func NewDhcpAPILeaseWithDefaults() *DhcpAPILease ``` -------------------------------- ### Gravity Metrics Source: https://github.com/beryju/gravity/blob/main/docs/content/_index.html Gravity collects its own metrics for all instances within a cluster, providing insights into load and client activity without requiring additional setup. These metrics can be visualized, for example, using Grafana. ```en Metrics ======= Everyone loves graphs. Gravity keeps its own metrics for all instances in a cluster, giving you an insight into the load and what clients are doing without requiring any extra setup. ``` -------------------------------- ### TftpAPIRoleConfigOutput API Documentation Source: https://github.com/beryju/gravity/blob/main/api/docs/TftpAPIRoleConfigOutput.md Provides documentation for the TftpAPIRoleConfigOutput Go struct, covering its properties and methods for instantiation and configuration. ```APIDOC TftpAPIRoleConfigOutput: Properties: Config: TftpRoleConfig - The TFTP role configuration. Methods: NewTftpAPIRoleConfigOutput(config TftpRoleConfig) *TftpAPIRoleConfigOutput Instantiates a new TftpAPIRoleConfigOutput object with provided configuration. NewTftpAPIRoleConfigOutputWithDefaults() *TftpAPIRoleConfigOutput Instantiates a new TftpAPIRoleConfigOutput object with default values. GetConfig() TftpRoleConfig Retrieves the Config field. GetConfigOk() (*TftpRoleConfig, bool) Retrieves the Config field and a boolean indicating if it was set. SetConfig(v TftpRoleConfig) Sets the Config field to the given value. ``` -------------------------------- ### DHCP Get Scopes Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDhcpApi.md Retrieves DHCP scopes, optionally filtering by a specific scope name. This endpoint requires no authorization. The provided Go example shows how to initialize the client and make the request, optionally specifying a scope name. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { name := "name_example" // string | Optionally get DHCP Scope by name (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesDhcpApi.DhcpGetScopes(context.Background()).Name(name).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDhcpApi.DhcpGetScopes``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DhcpGetScopes`: DhcpAPIScopesGetOutput fmt.Fprintf(os.Stdout, "Response from `RolesDhcpApi.DhcpGetScopes`: %v\n", resp) } ``` -------------------------------- ### API Documentation for TFTP Role Configuration Source: https://github.com/beryju/gravity/blob/main/api/README.md API documentation related to TFTP role configuration, including input and output structures. ```APIDOC TftpAPIRoleConfigInput TftpAPIRoleConfigOutput TftpRoleConfig ``` -------------------------------- ### InstanceAPIInstanceInfo Constructors Source: https://github.com/beryju/gravity/blob/main/api/docs/InstanceAPIInstanceInfo.md Provides methods for creating new instances of InstanceAPIInstanceInfo. NewInstanceAPIInstanceInfo allows instantiation with specific values, while NewInstanceAPIInstanceInfoWithDefaults uses default values. ```APIDOC NewInstanceAPIInstanceInfo(buildHash string, dirs ExtconfigExtConfigDirs, instanceIP string, instanceIdentifier string, version string) *InstanceAPIInstanceInfo Instantiates a new InstanceAPIInstanceInfo object with provided values. NewInstanceAPIInstanceInfoWithDefaults() *InstanceAPIInstanceInfo Instantiates a new InstanceAPIInstanceInfo object using default values. ``` -------------------------------- ### StdDevRtt Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/ApiAPIToolPingOutput.md Provides methods to get, get with status, and set the StdDevRtt field in ApiAPIToolPingOutput. ```Go func (o *ApiAPIToolPingOutput) GetStdDevRtt() int32 // Returns the StdDevRtt field if non-nil, zero value otherwise. func (o *ApiAPIToolPingOutput) GetStdDevRttOk() (*int32, bool) // Returns a tuple with the StdDevRtt field if it's non-nil, zero value otherwise // and a boolean to check if the value has been set. func (o *ApiAPIToolPingOutput) SetStdDevRtt(v int32) // Sets StdDevRtt field to given value. func (o *ApiAPIToolPingOutput) HasStdDevRtt() bool // Returns a boolean if a field has been set. ``` -------------------------------- ### PacketsSent Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/ApiAPIToolPingOutput.md Provides methods to get, get with status, and set the PacketsSent field in ApiAPIToolPingOutput. ```Go func (o *ApiAPIToolPingOutput) GetPacketsSent() int32 // Returns the PacketsSent field if non-nil, zero value otherwise. func (o *ApiAPIToolPingOutput) GetPacketsSentOk() (*int32, bool) // Returns a tuple with the PacketsSent field if it's non-nil, zero value otherwise // and a boolean to check if the value has been set. func (o *ApiAPIToolPingOutput) SetPacketsSent(v int32) // Sets PacketsSent field to given value. func (o *ApiAPIToolPingOutput) HasPacketsSent() bool // Returns a boolean if a field has been set. ``` -------------------------------- ### AuthAPIUser Getters and Setters Source: https://github.com/beryju/gravity/blob/main/api/docs/AuthAPIUser.md Details methods for getting and setting the Permissions and Username properties of an AuthAPIUser object. Includes methods to get values, get values with a boolean indicating presence, and set values, including options for setting to nil or unsetting. ```APIDOC AuthAPIUser: Methods: GetPermissions() []AuthPermission Description: Returns the Permissions field. GetPermissionsOk() (*[]AuthPermission, bool) Description: Returns the Permissions field and a boolean indicating if it was set. SetPermissions(v []AuthPermission) Description: Sets the Permissions field. SetPermissionsNil(b bool) Description: Sets the Permissions field to an explicit nil value. UnsetPermissions() Description: Ensures no value is present for the Permissions field. GetUsername() string Description: Returns the Username field. GetUsernameOk() (*string, bool) Description: Returns the Username field and a boolean indicating if it was set. SetUsername(v string) Description: Sets the Username field. ``` -------------------------------- ### Import Opnsense DNS Records via CLI Source: https://github.com/beryju/gravity/blob/main/docs/content/docs/dns/migration/opnsense.md Converts Opnsense DNS records from an XML backup file into Gravity equivalents using the Gravity CLI. The XML file needs to be accessible within the Gravity container. ```bash gravity cli convert opnsense /data/opnsense.xml ``` -------------------------------- ### DiscoverySubnetStart API Documentation Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDiscoveryApi.md Provides details on the DiscoverySubnetStart API endpoint, including path parameters, other parameters, return types, authorization, and HTTP request headers. This endpoint initiates a subnet discovery process. ```APIDOC DiscoverySubnetStart: Description: Initiates the discovery of subnets. Parameters: identifier (string): Identifier for the subnet discovery process. wait (bool): If true, waits for the discovery process to complete. Return Type: (empty response body) Authorization: No authorization required HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Get Backup Status Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesBackupApi.md Retrieves the status of the backup process. This is a simple GET request that returns the backup status information. ```APIDOC BackupStatus(ctx).Execute() Backup status Path Parameters: This endpoint does not need any parameter. Other Parameters: Other parameters are passed through a pointer to a apiBackupStatusRequest struct via the builder pattern Return type: [BackupBackupStatus](BackupBackupStatus.md) Authorization: No authorization required HTTP request headers: - Content-Type: Not defined - Accept: application/json ``` -------------------------------- ### Start Discovery Subnets Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDiscoveryApi.md Initiates the discovery process for subnets. This method starts the subnet discovery operation. ```APIDOC DiscoverySubnetStart Post /api/v1/discovery/subnets/start Discovery Subnets Parameters: None Returns: Status of the subnet discovery start operation. Example: ```go // Example usage for DiscoverySubnetStart would involve calling the API client method to initiate the process. ``` ``` -------------------------------- ### InstanceInstanceInfo Model and Methods (Go) Source: https://github.com/beryju/gravity/blob/main/api/docs/InstanceInstanceInfo.md Defines the InstanceInstanceInfo structure and provides methods for its creation, retrieval, and modification. Includes constructors and getter/setter methods for each property. ```APIDOC InstanceInstanceInfo: Properties: Identifier: string Ip: string Roles: []string Version: string Methods: NewInstanceInstanceInfo(identifier string, ip string, roles []string, version string) *InstanceInstanceInfo Instantiates a new InstanceInstanceInfo object with provided values. NewInstanceInstanceInfoWithDefaults() *InstanceInstanceInfo Instantiates a new InstanceInstanceInfo object with default values. GetIdentifier() string Returns the Identifier field. GetIdentifierOk() (*string, bool) Returns the Identifier field and a boolean indicating if it's set. SetIdentifier(v string) Sets the Identifier field. GetIp() string Returns the Ip field. GetIpOk() (*string, bool) Returns the Ip field and a boolean indicating if it's set. SetIp(v string) Sets the Ip field. GetRoles() []string Returns the Roles field. GetRolesOk() (*[]string, bool) Returns the Roles field and a boolean indicating if it's set. SetRoles(v []string) Sets the Roles field. SetRolesNil(b bool) Sets the Roles field to nil. UnsetRoles() Ensures no value is present for Roles. GetVersion() string Returns the Version field. GetVersionOk() (*string, bool) Returns the Version field and a boolean indicating if it's set. SetVersion(v string) Sets the Version field. ``` -------------------------------- ### BackupRoleConfig Accessors Source: https://github.com/beryju/gravity/blob/main/api/docs/BackupRoleConfig.md Methods for getting and setting the properties of BackupRoleConfig. Each property has a Get method, a GetOk method returning the value and a boolean indicating if it's set, and a Set method. ```APIDOC BackupRoleConfig: GetAccessKey(): string Returns the AccessKey field. GetAccessKeyOk(): (*string, bool) Returns a tuple with the AccessKey field and a boolean indicating if it's set. SetAccessKey(v string): Sets the AccessKey field to the given value. HasAccessKey(): bool Returns true if the AccessKey field has been set. GetBucket(): string Returns the Bucket field. GetBucketOk(): (*string, bool) Returns a tuple with the Bucket field and a boolean indicating if it's set. SetBucket(v string): Sets the Bucket field to the given value. HasBucket(): bool Returns true if the Bucket field has been set. GetCronExpr(): string Returns the CronExpr field. GetCronExprOk(): (*string, bool) Returns a tuple with the CronExpr field and a boolean indicating if it's set. SetCronExpr(v string): Sets the CronExpr field to the given value. HasCronExpr(): bool Returns true if the CronExpr field has been set. GetEndpoint(): string Returns the Endpoint field. GetEndpointOk(): (*string, bool) Returns a tuple with the Endpoint field and a boolean indicating if it's set. SetEndpoint(v string): Sets the Endpoint field to the given value. HasEndpoint(): bool Returns true if the Endpoint field has been set. GetPath(): string Returns the Path field. GetPathOk(): (*string, bool) Returns a tuple with the Path field and a boolean indicating if it's set. SetPath(v string): Sets the Path field to the given value. HasPath(): bool Returns true if the Path field has been set. GetSecretKey(): string Returns the SecretKey field. GetSecretKeyOk(): (*string, bool) Returns a tuple with the SecretKey field and a boolean indicating if it's set. SetSecretKey(v string): Sets the SecretKey field to the given value. HasSecretKey(): bool Returns true if the SecretKey field has been set. ``` -------------------------------- ### Call BackupStatus API in Go Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesBackupApi.md Example of how to call the BackupStatus API using the Gravity Go client library. It demonstrates setting up the configuration, creating an API client, executing the request, and handling potential errors and responses. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RolesBackupApi.BackupStatus(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesBackupApi.BackupStatus``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `BackupStatus`: BackupAPIBackupStatusOutput fmt.Fprintf(os.Stdout, "Response from `RolesBackupApi.BackupStatus`: %v\n", resp) } ``` -------------------------------- ### DnsAPIRecord Type and Uid Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/DnsAPIRecord.md Provides methods to get, get with ok check, and set the 'Type' and 'Uid' fields of a DnsAPIRecord. These methods facilitate safe access and modification of these string fields. ```APIDOC DnsAPIRecord: GetType() string Returns the Type field if non-nil, zero value otherwise. GetTypeOk() (*string, bool) Returns a tuple with the Type field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. SetType(v string) Sets the Type field to the given value. GetUid() string Returns the Uid field if non-nil, zero value otherwise. GetUidOk() (*string, bool) Returns a tuple with the Uid field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. SetUid(v string) Sets the Uid field to the given value. ``` -------------------------------- ### API Documentation for DHCP and OIDC Configuration Source: https://github.com/beryju/gravity/blob/main/api/README.md API documentation for DHCP options and OIDC configuration structures. ```APIDOC TypesDHCPOption TypesOIDCConfig ``` -------------------------------- ### BackupAPIRoleConfigInput Structure and Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/BackupAPIRoleConfigInput.md Defines the BackupAPIRoleConfigInput structure, including its properties and methods for instantiation and configuration. It covers constructors, getters, and setters for the Config property. ```APIDOC BackupAPIRoleConfigInput: Properties: Config: BackupRoleConfig Description: Configuration for the backup role. Methods: NewBackupAPIRoleConfigInput(config BackupRoleConfig) *BackupAPIRoleConfigInput Description: Instantiates a new BackupAPIRoleConfigInput object with the given configuration. Parameters: config: The BackupRoleConfig to set. Returns: A pointer to the created BackupAPIRoleConfigInput object. NewBackupAPIRoleConfigInputWithDefaults() *BackupAPIRoleConfigInput Description: Instantiates a new BackupAPIRoleConfigInput object with default values. Returns: A pointer to the created BackupAPIRoleConfigInput object. GetConfig() BackupRoleConfig Description: Retrieves the Config property of the BackupAPIRoleConfigInput. Returns: The BackupRoleConfig value. GetConfigOk() (*BackupRoleConfig, bool) Description: Retrieves the Config property and a boolean indicating if it was set. Returns: A tuple containing a pointer to the BackupRoleConfig and a boolean. SetConfig(v BackupRoleConfig) Description: Sets the Config property of the BackupAPIRoleConfigInput. Parameters: v: The BackupRoleConfig value to set. ``` -------------------------------- ### DnsAPIZone Constructors Source: https://github.com/beryju/gravity/blob/main/api/docs/DnsAPIZone.md Provides methods for creating new DnsAPIZone objects. NewDnsAPIZone allows instantiation with specific properties, while NewDnsAPIZoneWithDefaults uses default values. ```APIDOC NewDnsAPIZone(authoritative bool, defaultTTL int32, handlerConfigs []map[string]interface{}, hook string, name string, recordCount int32) *DnsAPIZone Instantiates a new DnsAPIZone object. Assigns default values and ensures required API properties are set. NewDnsAPIZoneWithDefaults() *DnsAPIZone Instantiates a new DnsAPIZone object using default property values. ``` -------------------------------- ### DHCP Put Role Config Go Example Source: https://github.com/beryju/gravity/blob/main/api/docs/RolesDhcpApi.md Provides a Go example for configuring DHCP roles using the `DhcpPutRoleConfig` method. It illustrates setting up the role configuration input and executing the API call. ```Go package main import ( "context" "fmt" "os" openapiclient "beryju.io/gravity/api" ) func main() { dhcpAPIRoleConfigInput := *openapiclient.NewDhcpAPIRoleConfigInput(*openapiclient.NewDhcpRoleConfig()) // DhcpAPIRoleConfigInput | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.RolesDhcpApi.DhcpPutRoleConfig(context.Background()).DhcpAPIRoleConfigInput(dhcpAPIRoleConfigInput).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RolesDhcpApi.DhcpPutRoleConfig``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` -------------------------------- ### DhcpAPIScopesPutInput Ttl Methods Source: https://github.com/beryju/gravity/blob/main/api/docs/DhcpAPIScopesPutInput.md Provides methods to get, get with status, and set the Ttl field for DhcpAPIScopesPutInput. GetTtl returns the Ttl value or zero if nil. GetTtlOk returns the Ttl value and a boolean indicating if it was set. SetTtl updates the Ttl field. ```go func (o *DhcpAPIScopesPutInput) GetTtl() int32 { // GetTtl returns the Ttl field if non-nil, zero value otherwise. } func (o *DhcpAPIScopesPutInput) GetTtlOk() (*int32, bool) { // GetTtlOk returns a tuple with the Ttl field if it's non-nil, zero value otherwise // and a boolean to check if the value has been set. } func (o *DhcpAPIScopesPutInput) SetTtl(v int32) { // SetTtl sets Ttl field to given value. } ```