Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Go API client for openapi

runZero API - deprecated

Overview

This API client was generated by an experimental version of the OpenAPI Generator project using an older version of the YAML spec file. It is deprecated, and you are strongly recommended not to use it.

By using a current version of the OpenAPI-spec runzero-api.yml YAML file (found in the root of this repository) with an up-to-date OpenAPI generator, you can easily generate an API client.

  • API version: 1.0.4
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./openapi"

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://console.runzero.com/api/v1.0

Class Method HTTP request Description
ExportApi ExportAssetSyncCreatedJSON Get /export/org/assets/sync/created/assets.json Exports the asset inventory in a sync-friendly manner using created_at as a checkpoint.
ExportApi ExportAssetSyncUpdatedJSON Get /export/org/assets/sync/updated/assets.json Exports the asset inventory in a sync-friendly manner using updated_at as a checkpoint.
ExportApi ExportAssetsCSV Get /export/org/assets.csv Asset inventory as CSV.
ExportApi ExportAssetsJSON Get /export/org/assets.json Exports the asset inventory.
ExportApi ExportAssetsJSONL Get /export/org/assets.jsonl Asset inventory as JSON line-delimited.
ExportApi ExportAssetsNmapXML Get /export/org/assets.nmap.xml Asset inventory as Nmap-style XML.
ExportApi ExportServicesCSV Get /export/org/services.csv Service inventory as CSV.
ExportApi ExportServicesJSON Get /export/org/services.json Service inventory as JSON.
ExportApi ExportServicesJSONL Get /export/org/services.jsonl Service inventory as JSON line-delimited.
ExportApi ExportSitesCSV Get /export/org/sites.csv Site list as CSV.
ExportApi ExportSitesJSON Get /export/org/sites.json Export all sites.
ExportApi ExportSitesJSONL Get /export/org/sites.jsonl Site list as JSON line-delimited.
ExportApi ExportWirelessCSV Get /export/org/wireless.csv Wireless inventory as CSV.
ExportApi ExportWirelessJSON Get /export/org/wireless.json Wireless inventory as JSON.
ExportApi ExportWirelessJSONL Get /export/org/wireless.jsonl Wireless inventory as JSON line-delimited.
OrganizationApi CreateScan Put /org/sites/{site_id}/scan Create a scan task for a given site.
OrganizationApi CreateSite Put /org/sites Create a new site.
OrganizationApi GetAgent Get /org/agents/{agent_id} Get details for a single agent.
OrganizationApi GetAgents Get /org/agents Get all agents.
OrganizationApi GetAsset Get /org/assets/{asset_id} Get asset details.
OrganizationApi GetAssets Get /org/assets Get all assets.
OrganizationApi GetKey Get /org/key Get API key details.
OrganizationApi GetOrganization Get /org Get organization details.
OrganizationApi GetService Get /org/services/{service_id} Get service details.
OrganizationApi GetServices Get /org/services Get all services.
OrganizationApi GetSite Get /org/sites/{site_id} Get site details.
OrganizationApi GetSites Get /org/sites Get all sites.
OrganizationApi GetTask Get /org/tasks/{task_id} Get task details.
OrganizationApi GetTaskChangeReport Get /org/tasks/{task_id}/changes Returns a temporary task change report data url.
OrganizationApi GetTaskScanData Get /org/tasks/{task_id}/data Returns a temporary task scan data url.
OrganizationApi GetTasks Get /org/tasks Get all tasks (last 1000).
OrganizationApi GetWirelessLAN Get /org/wirelesss/{wireless_id} Get wireless LAN details.
OrganizationApi GetWirelessLANs Get /org/wireless Get all wireless LANs.
OrganizationApi HideTask Post /org/tasks/{task_id}/hide Signal that a completed task should be hidden.
OrganizationApi ImportScanData Put /org/sites/{site_id}/import Import a scan data file into a site.
OrganizationApi RemoveAgent Delete /org/agents/{agent_id} Remove and uninstall an agent.
OrganizationApi RemoveAsset Delete /org/assets/{asset_id} Remove an asset.
OrganizationApi RemoveService Delete /org/services/{service_id} Remove a service.
OrganizationApi RemoveSite Delete /org/sites/{site_id} Remove a site and associated assets.
OrganizationApi RemoveWirelessLAN Delete /org/wirelesss/{wireless_id} Remove a wireless LAN.
OrganizationApi StopTask Post /org/tasks/{task_id}/stop Signal that a task should be stopped or canceled.
OrganizationApi UpdateAgentSite Patch /org/agents/{agent_id} Update the site associated with agent.
OrganizationApi UpdateAssetComments Patch /org/assets/{asset_id}/comments Update asset comments.
OrganizationApi UpdateAssetTags Patch /org/assets/{asset_id}/tags Update asset tags.
OrganizationApi UpdateOrganization Patch /org Update organization details.
OrganizationApi UpdateSite Patch /org/sites/{site_id} Update a site definition.
OrganizationApi UpdateTask Patch /org/tasks/{task_id} Update task parameters.
OrganizationApi UpgradeAgent Post /org/agents/{agent_id}/update Force an agent to update and restart.
PublicApi GetLatestAgentVersion Get /releases/agent/version Returns latest agent version.
PublicApi GetLatestPlatformVersion Get /releases/platform/version Returns latest platform version.
PublicApi GetLatestScannerVersion Get /releases/scanner/version Returns latest scanner version.

Documentation For Models

Documentation For Authorization

bearerAuth

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]