### Go: Install API Client Dependencies Source: https://github.com/runzeroinc/runzero-api/blob/main/go/README.md Installs necessary dependencies for the Go API client using 'go get'. These include libraries for testing and network context. ```shell go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context ``` -------------------------------- ### Get Organization Details using Go Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Fetches organization details using the RunZero Go client. This example demonstrates client initialization, context setup, and execution of the GetOrganization method, including error handling. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetOrganization(context.Background(), ).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetOrganization``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrganization`: Organization fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetOrganization`: %v\n", resp) } ``` -------------------------------- ### Get All RunZero Sites in Go Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Fetches a list of all sites within the RunZero environment. This Go example illustrates the process of initializing the API client and making a request to the GetSites endpoint, including basic error handling. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetSites(context.Background(), ).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetSites``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetSites`: []Site fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetSites`: %v\n", resp) } ``` -------------------------------- ### Task GetStartTime and SetStartTime Methods (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Task.md Provides methods to get and set the 'StartTime' as a Unix timestamp (int64). GetStartTime retrieves the start time, and SetStartTime updates it. Crucial for task scheduling and execution timing. ```go func (o *Task) GetStartTime() int64 { return o.StartTime } func (o *Task) GetStartTimeOk() (*int64, bool) { if !o.HasStartTime() { return nil, false } return &o.StartTime, true } func (o *Task) SetStartTime(v int64) { o.StartTime = v } func (o *Task) HasStartTime() bool { return o.StartTime != 0 } ``` -------------------------------- ### Get RunZero Services with Search Filter in Go Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Fetches a list of services from the RunZero API, with an optional search string to filter the results. This example demonstrates initializing the API client, setting the search parameter, executing the request, and handling potential errors. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { search := "search_example" // string | an optional search string for filtering results (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetServices(context.Background(), ).Search(search).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetServices``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetServices`: []Service fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetServices`: %v\n", resp) } ``` -------------------------------- ### Get and Set Service Created At Timestamp (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Service.md Provides methods to get the creation timestamp, get it with a boolean check, set the timestamp, and check if it has been set. These methods are used for managing the creation time of a service, typically as an int64. ```go func (o *Service) GetCreatedAt() int64 { // ... implementation details ... return 0 } func (o *Service) GetCreatedAtOk() (*int64, bool) { // ... implementation details ... return nil, false } func (o *Service) SetCreatedAt(v int64) { // ... implementation details ... } func (o *Service) HasCreatedAt() bool { // ... implementation details ... return false } ``` -------------------------------- ### Get and Set Service Protocol (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Service.md Provides methods to get, get with boolean check, set, and check for the existence of the ServiceProtocol field in a Service object. These methods handle nil checks and value setting for string fields. ```go func (o *Service) GetServiceProtocol() string { // ... implementation details ... return "" } func (o *Service) GetServiceProtocolOk() (*string, bool) { // ... implementation details ... return nil, false } func (o *Service) SetServiceProtocol(v string) { // ... implementation details ... } func (o *Service) HasServiceProtocol() bool { // ... implementation details ... return false } ``` -------------------------------- ### GET /org/services Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get all services. Retrieves a list of all network services discovered by RunZero. ```APIDOC ## GET /org/services ### Description Get all services. ### Method GET ### Endpoint /org/services ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) A list of all discovered network services. #### Response Example ```json [ { "serviceId": "service_abc", "assetId": "asset_qwerty", "protocol": "TCP", "port": 80, "state": "open" }, { "serviceId": "service_def", "assetId": "asset_asdfg", "protocol": "UDP", "port": 161, "state": "open" } ] ``` ``` -------------------------------- ### Get Latest Agent Version (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/PublicAPI.md Retrieves the latest agent version from the RunZero API. This Go example shows how to set up the API client and call the GetLatestAgentVersion endpoint, handling potential errors and printing the response. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.PublicApi.GetLatestAgentVersion(context.Background(), ).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `PublicApi.GetLatestAgentVersion``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetLatestAgentVersion`: ComponentVersion fmt.Fprintf(os.Stdout, "Response from `PublicApi.GetLatestAgentVersion`: %v\n", resp) } ``` -------------------------------- ### GET /org/sites Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get all sites. Retrieves a list of all network sites configured within the organization. ```APIDOC ## GET /org/sites ### Description Get all sites. ### Method GET ### Endpoint /org/sites ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) A list of all sites. #### Response Example ```json [ { "siteId": "site_abcde", "name": "Office Network" }, { "siteId": "site_fghij", "name": "Warehouse Network" } ] ``` ``` -------------------------------- ### GET /org/assets Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get all assets. Retrieves a list of all assets discovered across all sites in the organization. ```APIDOC ## GET /org/assets ### Description Get all assets. ### Method GET ### Endpoint /org/assets ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) A list of all discovered assets. #### Response Example ```json [ { "assetId": "asset_qwerty", "ipAddress": "192.168.1.100", "macAddress": "00:1A:2B:3C:4D:5E", "hostName": "server-01", "os": "Windows Server 2019", "tags": ["production", "webserver"] }, { "assetId": "asset_asdfg", "ipAddress": "192.168.1.101", "macAddress": "00:6A:7B:8C:9D:0E", "hostName": "client-05", "os": "Windows 10", "tags": ["user", "laptop"] } ] ``` ``` -------------------------------- ### Get Description from SiteOptions (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/SiteOptions.md Retrieves the value of the 'Description' field from a SiteOptions object. If the 'Description' field is nil, it returns the zero value for a string. ```go func (o *SiteOptions) GetDescription() string { // Implementation omitted for brevity } ``` -------------------------------- ### GET /api/v1/organization/services Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Retrieves a list of services within the organization, with optional filtering by a search string. This endpoint is useful for finding specific services or getting an overview of network assets. ```APIDOC ## GET /api/v1/organization/services ### Description Retrieves a list of services within the organization, with optional filtering by a search string. ### Method GET ### Endpoint /api/v1/organization/services ### Parameters #### Query Parameters - **search** (string) - Optional - An optional search string for filtering results. ### Request Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { search := "search_example" configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetServices(context.Background(), ).Search(search).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetServices``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetServices`: %v\n", resp) } ``` ### Response #### Success Response (200) - **[]Service** (array) - A list of services. #### Response Example ```json { "example": "[]Service" } ``` ``` -------------------------------- ### GET /api/v1/assets Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Retrieves a list of all assets. Supports optional search filtering. ```APIDOC ## GET /api/v1/assets ### Description Get all assets. This endpoint retrieves a list of all assets, with an option to filter using a search string. ### Method GET ### Endpoint /api/v1/assets ### Parameters #### Query Parameters - **search** (string) - Optional - An optional search string for filtering results. ### Request Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { search := "search_example" // string | an optional search string for filtering results (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetAssets(context.Background()).Search(search).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetAssets``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetAssets`: []Asset fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetAssets`: %v\n", resp) } ``` ### Return type [**[]Asset**](Asset.md) ### Authorization [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ``` -------------------------------- ### Instantiate New SiteOptions (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/SiteOptions.md Creates a new SiteOptions object. This constructor initializes the object, setting default values for properties where defined and ensuring all API-required properties are set. ```go func NewSiteOptions(name string, ) *SiteOptions { // Implementation omitted for brevity } ``` -------------------------------- ### GET /export/org/sites.json Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports all sites as a JSON file. ```APIDOC ## GET /export/org/sites.json ### Description Exports a list of all sites within the organization in JSON format. ### Method GET ### Endpoint /export/org/sites.json ### Query Parameters None ### Request Example ``` GET /api/v1.0/export/org/sites.json ``` ### Response #### Success Response (200) - **sites** (array) - A list of site objects. #### Response Example ```json [ { "id": "site-123", "name": "Main Office", "last_scan_time": "2023-10-27T10:00:00Z", "status": "Completed" }, { "id": "site-456", "name": "Warehouse", "last_scan_time": "2023-10-26T15:30:00Z", "status": "Running" } ] ``` ``` -------------------------------- ### Instantiate OrgOptions Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrgOptions.md Provides methods to create new instances of the OrgOptions struct. NewOrgOptions initializes with default values and ensures required properties are set, while NewOrgOptionsWithDefaults only applies default values without guaranteeing required properties are set. ```go func NewOrgOptions() *OrgOptions { // ... implementation details ... } func NewOrgOptionsWithDefaults() *OrgOptions { // ... implementation details ... } ``` -------------------------------- ### GET /export/org/sites.jsonl Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports the list of sites as a JSON line-delimited file. ```APIDOC ## GET /export/org/sites.jsonl ### Description Exports a list of all sites within the organization in JSON Lines (JSONL) format, where each line is a valid JSON object representing a site. ### Method GET ### Endpoint /export/org/sites.jsonl ### Query Parameters None ### Request Example ``` GET /api/v1.0/export/org/sites.jsonl ``` ### Response #### Success Response (200) - **Content** (string) - A file where each line is a JSON object representing a site. #### Response Example ```jsonl {"id": "site-123", "name": "Main Office", "last_scan_time": "2023-10-27T10:00:00Z", "status": "Completed"} {"id": "site-456", "name": "Warehouse", "last_scan_time": "2023-10-26T15:30:00Z", "status": "Running"} ``` ``` -------------------------------- ### Instantiate New Site Object (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Site.md Provides methods to create a new Site object. NewSite requires an ID and name, while NewSiteWithDefaults creates an object with default property values. ```go func NewSite(id string, name string) *Site { // Implementation details omitted for brevity return &Site{} } func NewSiteWithDefaults() *Site { // Implementation details omitted for brevity return &Site{} } ``` -------------------------------- ### GET /export/org/wireless.jsonl Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports the wireless inventory as a JSON line-delimited file. ```APIDOC ## GET /export/org/wireless.jsonl ### Description Exports the wireless inventory of the organization in JSON Lines (JSONL) format, where each line is a valid JSON object representing a wireless device. ### Method GET ### Endpoint /export/org/wireless.jsonl ### Query Parameters None ### Request Example ``` GET /api/v1.0/export/org/wireless.jsonl ``` ### Response #### Success Response (200) - **Content** (string) - A file where each line is a JSON object representing a wireless device. #### Response Example ```jsonl {"mac_address": "AA:BB:CC:DD:EE:FF", "ssid": "MyWiFi", "signal_strength": -50, "encryption": "WPA2", "client_ip": "192.168.1.100", "device_type": "Laptop"} {"mac_address": "11:22:33:44:55:66", "ssid": "GuestNet", "signal_strength": -70, "encryption": "Open", "client_ip": "192.168.1.101", "device_type": "Phone"} ``` ``` -------------------------------- ### Go: Select Server Configuration Source: https://github.com/runzeroinc/runzero-api/blob/main/go/README.md Shows how to select a different server configuration for the API client by setting the server index in the context. ```go ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1) ``` -------------------------------- ### GET /export/org/assets.nmap.xml Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports the complete asset inventory in Nmap-style XML format. ```APIDOC ## GET /export/org/assets.nmap.xml ### Description Exports the entire asset inventory of the organization in an XML format compatible with Nmap's output. ### Method GET ### Endpoint /export/org/assets.nmap.xml ### Query Parameters None ### Request Example ``` GET /api/v1.0/export/org/assets.nmap.xml ``` ### Response #### Success Response (200) - **Content** (file) - An XML file containing asset data in Nmap format. #### Response Example ```xml
``` ``` -------------------------------- ### Get Service Details by ID using Go Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Retrieves specific service details by its ID using the RunZero Go client. The example shows how to pass the serviceId, configure the client, and execute the GetService method with error handling. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { serviceId := TODO // string | UUID of the service to retrieve configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetService(context.Background(), serviceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetService``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetService`: Service fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetService`: %v\n", resp) } ``` -------------------------------- ### Instantiate New Agent Object (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Agent.md Provides constructors for creating new Agent objects. NewAgent instantiates an agent with default values and ensures required properties are set, while NewAgentWithDefaults creates an agent with only default values assigned. ```Go func NewAgent(id string, ) *Agent func NewAgentWithDefaults() *Agent ``` -------------------------------- ### GET /export/org/sites.csv Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports the list of sites as a CSV file. ```APIDOC ## GET /export/org/sites.csv ### Description Exports a list of all sites within the organization in CSV format. ### Method GET ### Endpoint /export/org/sites.csv ### Query Parameters None ### Request Example ``` GET /api/v1.0/export/org/sites.csv ``` ### Response #### Success Response (200) - **Content** (file) - A CSV file containing site data. #### Response Example ```csv "Site ID","Name","Last Scan Time","Status" "site-123","Main Office","2023-10-27T10:00:00Z","Completed" "site-456","Warehouse","2023-10-26T15:30:00Z","Running" ``` ``` -------------------------------- ### Go: Import API Client Package Source: https://github.com/runzeroinc/runzero-api/blob/main/go/README.md Demonstrates how to import the generated Go API client package into your project. ```go import sw "./openapi" ``` -------------------------------- ### Get RunZero Site Details by ID in Go Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Retrieves the details of a specific site from the RunZero API using its ID. The example shows how to configure the API client, specify the site ID, execute the request, and handle the response or any errors that occur. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { siteId := TODO // string | UUID or name of the site configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetSite(context.Background(), siteId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetSite``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetSite`: Site fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetSite`: %v\n", resp) } ``` -------------------------------- ### GET /api/v1/organization/sites Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Retrieves a list of all sites within the organization. This endpoint provides a comprehensive overview of all configured network sites. ```APIDOC ## GET /api/v1/organization/sites ### Description Retrieves a list of all sites within the organization. ### Method GET ### Endpoint /api/v1/organization/sites ### Parameters This endpoint does not require any parameters. ### Request Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetSites(context.Background(), ).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetSites``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetSites`: %v\n", resp) } ``` ### Response #### Success Response (200) - **[]Site** (array) - A list of all sites. #### Response Example ```json { "example": "[]Site" } ``` ``` -------------------------------- ### Get RunZero Wireless LAN by ID (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md This Go code snippet shows how to retrieve details for a specific wireless LAN using its UUID. It utilizes the openapiclient library to make the API call. The example includes error handling and prints the retrieved wireless LAN data. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { wirelessId := TODO // string | UUID of the wireless LAN to retrieve configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.GetWirelessLAN(context.Background(), wirelessId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.GetWirelessLAN``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetWirelessLAN`: Wireless fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.GetWirelessLAN`: %v\n", resp) } ``` -------------------------------- ### Task Creation Methods (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Task.md Provides functions for creating new Task objects. `NewTask` requires an ID and initializes a Task, while `NewTaskWithDefaults` creates a Task with default values, potentially omitting required API fields. ```Go func NewTask(id string) *Task func NewTaskWithDefaults() *Task ``` -------------------------------- ### GET /releases/platform/version Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/PublicAPI.md Retrieves the latest platform version information from the Runzero API. ```APIDOC ## GET /releases/platform/version ### Description Returns latest platform version. ### Method GET ### Endpoint /releases/platform/version ### Parameters #### Path Parameters This endpoint does not need any path parameters. #### Query Parameters This endpoint does not need any query parameters. #### Request Body This endpoint does not accept a request body. ### Request Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.PublicApi.GetLatestPlatformVersion(context.Background(), ).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `PublicApi.GetLatestPlatformVersion``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetLatestPlatformVersion`: ComponentVersion fmt.Fprintf(os.Stdout, "Response from `PublicApi.GetLatestPlatformVersion`: %v\n", resp) } ``` ### Response #### Success Response (200) - **version** (string) - The latest platform version. - **released** (string) - The release date of the platform version. #### Response Example ```json { "version": "2.0.0", "released": "2023-10-27T10:00:00Z" } ``` ### Authorization No authorization required ``` -------------------------------- ### APIKey Resource Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ApiKey.md Details about the APIKey resource, including its properties and methods for instantiation and manipulation. ```APIDOC ## APIKey Resource ### Description Represents an API key within the RunZero system. This includes details such as its ID, creation timestamp, usage statistics, and associated client or organization. ### Properties - **Id** (string) - Required - Unique identifier for the API key. - **ClientId** (string) - Optional - Identifier for the client associated with the API key. - **OrganizationId** (string) - Optional - Identifier for the organization associated with the API key. - **CreatedAt** (int64) - Optional - Timestamp of when the API key was created. - **CreatedBy** (string) - Optional - Identifier of the user who created the API key. - **Comment** (string) - Optional - A descriptive comment for the API key. - **LastUsedAt** (int64) - Optional - Timestamp of the last time the API key was used. - **LastUsedIp** (string) - Optional - IP address from which the API key was last used. - **LastUsedUa** (string) - Optional - User agent string from the last usage of the API key. - **Counter** (int64) - Optional - Counter for API key usage. - **UsageToday** (int64) - Optional - Amount of usage for the API key today. - **UsageLimit** (int64) - Optional - The usage limit set for the API key. - **Token** (string) - Optional - The API key token itself. - **Inactive** (bool) - Optional - Flag indicating if the API key is inactive. ### Methods #### NewAPIKey **Description**: Instantiates a new APIKey object. **Signature**: `func NewAPIKey(id string) *APIKey` #### NewAPIKeyWithDefaults **Description**: Instantiates a new APIKey object with default values. **Signature**: `func NewAPIKeyWithDefaults() *APIKey` #### GetId **Description**: Returns the Id field. **Signature**: `func (o *APIKey) GetId() string` #### GetIdOk **Description**: Returns the Id field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetIdOk() (*string, bool)` #### SetId **Description**: Sets the Id field. **Signature**: `func (o *APIKey) SetId(v string)` #### GetClientId **Description**: Returns the ClientId field. **Signature**: `func (o *APIKey) GetClientId() string` #### GetClientIdOk **Description**: Returns the ClientId field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetClientIdOk() (*string, bool)` #### SetClientId **Description**: Sets the ClientId field. **Signature**: `func (o *APIKey) SetClientId(v string)` #### HasClientId **Description**: Checks if the ClientId field has been set. **Signature**: `func (o *APIKey) HasClientId() bool` #### GetOrganizationId **Description**: Returns the OrganizationId field. **Signature**: `func (o *APIKey) GetOrganizationId() string` #### GetOrganizationIdOk **Description**: Returns the OrganizationId field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetOrganizationIdOk() (*string, bool)` #### SetOrganizationId **Description**: Sets the OrganizationId field. **Signature**: `func (o *APIKey) SetOrganizationId(v string)` #### HasOrganizationId **Description**: Checks if the OrganizationId field has been set. **Signature**: `func (o *APIKey) HasOrganizationId() bool` #### GetCreatedAt **Description**: Returns the CreatedAt field. **Signature**: `func (o *APIKey) GetCreatedAt() int64` #### GetCreatedAtOk **Description**: Returns the CreatedAt field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetCreatedAtOk() (*int64, bool)` #### SetCreatedAt **Description**: Sets the CreatedAt field. **Signature**: `func (o *APIKey) SetCreatedAt(v int64)` #### HasCreatedAt **Description**: Checks if the CreatedAt field has been set. **Signature**: `func (o *APIKey) HasCreatedAt() bool` #### GetCreatedBy **Description**: Returns the CreatedBy field. **Signature**: `func (o *APIKey) GetCreatedBy() string` #### GetCreatedByOk **Description**: Returns the CreatedBy field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetCreatedByOk() (*string, bool)` #### SetCreatedBy **Description**: Sets the CreatedBy field. **Signature**: `func (o *APIKey) SetCreatedBy(v string)` #### HasCreatedBy **Description**: Checks if the CreatedBy field has been set. **Signature**: `func (o *APIKey) HasCreatedBy() bool` #### GetComment **Description**: Returns the Comment field. **Signature**: `func (o *APIKey) GetComment() string` #### GetCommentOk **Description**: Returns the Comment field and a boolean indicating if it was set. **Signature**: `func (o *APIKey) GetCommentOk() (*string, bool)` #### SetComment **Description**: Sets the Comment field. **Signature**: `func (o *APIKey) SetComment(v string)` #### HasComment **Description**: Checks if the Comment field has been set. **Signature**: `func (o *APIKey) HasComment() bool` #### GetLastUsedAt **Description**: Returns the LastUsedAt field. **Signature**: `func (o *APIKey) GetLastUsedAt() int64` ``` -------------------------------- ### GET /org/agents Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get all agents. Retrieves a list of all agents associated with the organization. ```APIDOC ## GET /org/agents ### Description Get all agents. ### Method GET ### Endpoint /org/agents ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) A list of all agents. #### Response Example ```json [ { "agentId": "agent_xyz789", "name": "My Agent", "version": "1.2.3", "siteId": "site_abcde", "status": "active" }, { "agentId": "agent_uvw456", "name": "Another Agent", "version": "1.2.2", "siteId": "site_fghij", "status": "inactive" } ] ``` ``` -------------------------------- ### Get Latest Platform Version Source: https://github.com/runzeroinc/runzero-api/blob/main/go/README.md Retrieves the latest available version of the RunZero platform. ```APIDOC ## GET /releases/platform/version ### Description Returns latest platform version. ### Method GET ### Endpoint /releases/platform/version ### Response #### Success Response (200) * **version** (string) - The latest platform version string. #### Response Example ```json { "version": "2.0.0" } ``` ``` -------------------------------- ### POST /api/v1/organization/sites Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Creates a new site within the organization. Site creation requires specifying site options such as name, description, scope, and exclusion patterns. ```APIDOC ## POST /api/v1/organization/sites ### Description Creates a new site within the organization. Site creation requires specifying site options such as name, description, scope, and exclusion patterns. ### Method POST ### Endpoint /api/v1/organization/sites ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **siteOptions** (SiteOptions) - Required - Site definition including name, description, scope, and excludes. ### Request Example ```go { "siteOptions": { "name": "Name_example", "description": "Description_example", "scope": "Scope_example", "excludes": "Excludes_example" } } ``` ### Response #### Success Response (200) - **Site** (Site) - Details of the newly created site. #### Response Example ```json { "id": "string", "name": "string", "description": "string" } ``` ``` -------------------------------- ### Go: Instantiate New URL Object Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Url.md Provides methods to create a new URL object. NewURL assigns default values and ensures required properties are set, while NewURLWithDefaults only assigns default values without guaranteeing required properties are set. ```Go func NewURL() *URL NewURL instantiates a new URL object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed ``` ```Go func NewURLWithDefaults() *URL NewURLWithDefaults instantiates a new URL object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ``` -------------------------------- ### Instantiate SiteOptions with Defaults (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/SiteOptions.md Creates a new SiteOptions object with default values. This constructor assigns default values to properties that have them defined, but does not guarantee that properties required by the API are set. ```go func NewSiteOptionsWithDefaults() *SiteOptions { // Implementation omitted for brevity } ``` -------------------------------- ### GET /org Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get organization details. Retrieves general information about the RunZero organization. ```APIDOC ## GET /org ### Description Get organization details. ### Method GET ### Endpoint /org ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Information about the organization. #### Response Example ```json { "organizationId": "org_12345", "name": "My Company Inc.", "createdAt": "2022-05-15T09:30:00Z" } ``` ``` -------------------------------- ### GET /api/v2/export/sites.jsonl Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/ExportAPI.md Exports the site list as JSON line-delimited. Supports filtering by a search string and specifying which fields to include. ```APIDOC ## GET /api/v2/export/sites.jsonl ### Description Exports the site list as JSON line-delimited. Supports filtering by a search string and specifying which fields to include. ### Method GET ### Endpoint /api/v2/export/sites.jsonl ### Query Parameters - **search** (string) - Optional - An optional search string for filtering results. - **fields** (string) - Optional - An optional list of fields to export, comma-separated. ### Request Example ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { search := "search_example" // string | an optional search string for filtering results (optional) fields := "fields_example" // string | an optional list of fields to export, comma-separated (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.ExportApi.ExportSitesJSONL(context.Background(), ).Search(search).Fields(fields).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ExportApi.ExportSitesJSONL`: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ExportSitesJSONL`: *os.File fmt.Fprintf(os.Stdout, "Response from `ExportApi.ExportSitesJSONL`: %v\n", resp) } ``` ### Response #### Success Response (200) - ***os.File** - A file object containing the site data in JSON line-delimited format. #### Response Example (Response structure depends on the fields requested) ``` -------------------------------- ### Create RunZero Site Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Creates a new site within the RunZero environment. This method uses the `CreateSite` function from the `OrganizationApi`. It requires `SiteOptions` which define the site's name, description, scope, and exclusions. The function returns a `Site` object upon successful creation. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { siteOptions := openapiclient.SiteOptions{Name: "Name_example", Description: "Description_example", Scope: "Scope_example", Excludes: "Excludes_example"} // SiteOptions | site definition configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.CreateSite(context.Background(), siteOptions).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.CreateSite``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateSite`: Site fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.CreateSite`: %v\n", resp) } ``` -------------------------------- ### Get and Set Service Organization ID (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/Service.md Provides methods to get the organization ID associated with a service, get it with a boolean check, set a new organization ID, and check if the field has been populated. These are vital for service organization management. ```go func (o *Service) GetOrganizationId() string { // ... implementation details ... return "" } func (o *Service) GetOrganizationIdOk() (*string, bool) { // ... implementation details ... return nil, false } func (o *Service) SetOrganizationId(v string) { // ... implementation details ... } func (o *Service) HasOrganizationId() bool { // ... implementation details ... return false } ``` -------------------------------- ### GET /org/wireless Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get all wireless LANs. Retrieves a list of all discovered wireless LANs in the organization. ```APIDOC ## GET /org/wireless ### Description Get all wireless LANs. ### Method GET ### Endpoint /org/wireless ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) A list of all discovered wireless LANs. #### Response Example ```json [ { "wirelessId": "wl_111", "ssid": "OfficeWiFi", "bssid": "AA:BB:CC:DD:EE:FF", "channel": 6, "siteId": "site_abcde" }, { "wirelessId": "wl_222", "ssid": "GuestWiFi", "bssid": "11:22:33:44:55:66", "channel": 11, "siteId": "site_fghij" } ] ``` ``` -------------------------------- ### Go: Configure Templated Server URL Source: https://github.com/runzeroinc/runzero-api/blob/main/go/README.md Illustrates how to configure a templated server URL by providing variables through the context. ```go ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{ "basePath": "v2", }) ``` -------------------------------- ### GET /org/tasks/{task_id} Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Get task details. Retrieves the status and information for a specific task. ```APIDOC ## GET /org/tasks/{task_id} ### Description Get task details. ### Method GET ### Endpoint /org/tasks/{task_id} ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the task to retrieve. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Detailed information about the specified task. #### Response Example ```json { "taskId": "scan_12345", "type": "scan", "status": "completed", "siteId": "site_abcde", "startedAt": "2023-10-26T14:00:00Z", "completedAt": "2023-10-26T15:30:00Z" } ``` ``` -------------------------------- ### Import Scan Data to RunZero Site (Go) Source: https://github.com/runzeroinc/runzero-api/blob/main/go/docs/OrganizationAPI.md Shows how to import scan data into a RunZero site using the API. This Go example sets up the API client, specifies the site ID and the data file, and executes the `ImportScanData` method. It includes logging of the response and potential errors. ```go package main import ( "context" "fmt" "os" openapiclient "./openapi" ) func main() { siteId := TODO // string | UUID or name of the site to import scan data into body := 987 // *os.File | (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) resp, r, err := api_client.OrganizationApi.ImportScanData(context.Background(), siteId).Body(body).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrganizationApi.ImportScanData``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ImportScanData`: Task fmt.Fprintf(os.Stdout, "Response from `OrganizationApi.ImportScanData`: %v\n", resp) } ```