package
0.0.0-20221122131132-f14f255c0f01
Repository: https://github.com/threatstack/ts.git
Documentation: pkg.go.dev

# README

api

The API is a library with some structs and a request wrapper. Also a work in progress.

Exported Functions and Types

The TS CLI exports a few Go functions and types - those are available under the api directory.

Here's an example of how you could call the API on your own.

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"

	tsapi "github.com/threatstack/ts/api"
)

func main() {
	config := tsapi.Config{
		User: "USER_ID",
		Key:  "API_KEY",
		Org:  "ORG_ID",
	}
	client := &http.Client{}
	agentEndpoint := "/v2/agents/d1230d0f-392b-1ee9-b92a-5b6ae75feb22"
	req, err := tsapi.Request(config, "GET", agentEndpoint, nil)
	resp, err := client.Do(req)
	if err != nil {
		log.Fatalln(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode == 200 {
		body, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			log.Fatalln(err)
		}
		fmt.Printf("%s\n", body)
	} else {
		fmt.Printf("Unable to GET %s - API responded with an HTTP/%d", agentEndpoint, resp.StatusCode)
		os.Exit(1)
	}
}

# Functions

Request is a generic API client for sending authenticated requests to the Threat Stack API.

# Constants

DismissBusinessOp - Required for Business Operations.
DismissCompanyPolicy - Normal per Company Policy.
DismissMaintenance - Required Temporarily, for Testing and Maintenance.
DismissOther - Other.

# Structs

Agent is the object for an actual agent.
AgentIPInfo contains information about interfaces.
AgentResponseRaw is the raw result returned from the API.
AgentTagInfo contains information about cloud provider tags.
Alert stores information related to an individual alert.
AlertAggregate is part of an Alert.
AlertResponseRaw is the raw result returned from the API.
AlertSeverityCount is the data model for alerts by severity.
AuditRecord is an actual audit record.
AuditResponseRaw is the raw result returned from the API.
Config configures the API object.
DismissAlertsByID is the data model for dismissing an alert or 512.
DismissAlertByQueryParameters is the data model for dismissing an alert by a query vs.
Error is used to display errors.
invite Post.
No description provided by the author
Members is the model response.
No description provided by the author
S3ExportDelete is the model for an S3 Enrollment Delete.
S3ExportEnrollment is the model for sending a new enrollment up.
S3ExportEnrollmentResponse is the model for an S3 Enrollment GET.

# Type aliases

DismissReason stores different reasons for dismissing an alert.