netskope

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

go-netskope

Netskope API Client Library

Table of Contents

Getting Started

First, install skopecli:

go get -u github.com/greenpau/go-netskope/cmd/skopecli

Next, set environment variables for Netskope API Token:

export NETSKOPE_TOKEN=8c5e8866-0062-4059-b2be-92707e4374da
export NETSKOPE_TENANT_NAME=acmeprod

Alternatively, the settings could be passed in a configuration file. There are two options:

  1. The skopecli.yaml should be located in $HOME/.config/skopecli or current directory
  2. Pass the location via -config flag
---
token: 8c5e8866-0062-4059-b2be-92707e4374da
tenant_name: acmeprod

The following command fetches client data from Netskope API:

skopecli -get-client-data

Documentation

Index

Constants

View Source
const ReceiverDataLimit int64 = 1e6

ReceiverDataLimit is the limit of data in bytes the client will read from a server.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an instance of Proofpoint API client.

func NewClient

func NewClient(opts map[string]interface{}) (*Client, error)

NewClient returns an instance of Client.

func (*Client) Close

func (c *Client) Close()

Close performs a cleanup associated with Client..

func (*Client) GetClientEndpoints

func (c *Client) GetClientEndpoints(opts map[string]interface{}) ([]*ClientEndpoint, error)

GetClientEndpoints returns a list of ClientEndpoint instances.

func (*Client) Info

func (c *Client) Info()

Info sends information about Client to the configured logger.

func (*Client) SetHost

func (c *Client) SetHost(s string) error

SetHost sets the target host for the API calls.

func (*Client) SetPort

func (c *Client) SetPort(p int) error

SetPort sets the port number for the API calls.

func (*Client) SetProtocol

func (c *Client) SetProtocol(s string) error

SetProtocol sets the protocol for the API calls.

func (*Client) SetTenantName

func (c *Client) SetTenantName(s string) error

SetTenantName sets API tenant name.

func (*Client) SetToken

func (c *Client) SetToken(s string) error

SetToken sets API token.

func (*Client) SetValidateServerCertificate

func (c *Client) SetValidateServerCertificate() error

SetValidateServerCertificate instructs the client to enforce the validation of certificates and check certificate errors.

type ClientEndpoint

type ClientEndpoint struct {
	ID               string  `json:"_id,omitempty"`
	DeviceID         string  `json:"device_id,omitempty"`
	InstallTimestamp float64 `json:"client_install_time,omitempty"`
	Version          string  `json:"client_version,omitempty"`
	Users            []*User `json:"users,omitempty"`
	HostInfo         *Host   `json:"host_info,omitempty"`
	LastEvent        *Event  `json:"last_event,omitempty"`
}

ClientEndpoint is a compute endpoint.

func (*ClientEndpoint) ToJSONString

func (c *ClientEndpoint) ToJSONString() (string, error)

ToJSONString serializes ClientEndpoint to a string.

func (*ClientEndpoint) UnmarshalJSON

func (c *ClientEndpoint) UnmarshalJSON(b []byte) error

UnmarshalJSON unpacks byte array into ClientEndpoint.

type ClientEndpointResponse

type ClientEndpointResponse struct {
	Status          string            `json:"success,omitempty"`
	Message         string            `json:"msg,omitempty"`
	ClientEndpoints []*ClientEndpoint `json:"data,omitempty"`
}

ClientEndpointResponse is response from clients API endpoint.

type Event

type Event struct {
	Actor     string  `json:"actor,omitempty"`
	Name      string  `json:"event,omitempty"`
	NpaStatus string  `json:"npa_status,omitempty"`
	Status    string  `json:"status,omitempty"`
	Timestamp float64 `json:"timestamp,omitempty"`
}

Event is an event and its attributes.

type Host

type Host struct {
	DeviceMake             string `json:"device_make,omitempty"`
	DeviceModel            string `json:"device_model,omitempty"`
	Hostname               string `json:"hostname,omitempty"`
	ManagementID           string `json:"managementID,omitempty"`
	OperatingSystemName    string `json:"os,omitempty"`
	OperatingSystemVersion string `json:"os_version,omitempty"`
	NsDeviceUID            string `json:"nsdeviceuid,omitempty"`
}

Host is a host with its attributes.

type User

type User struct {
	ID                         string `json:"_id,omitempty"`
	DeviceClassificationStatus string `json:"device_classification_status,omitempty"`
	LastEvent                  *Event
	OrganizationUnit           string   `json:"organization_unit,omitempty"`
	AddedTimestamp             float64  `json:"user_added_time,omitempty"`
	Groups                     []string `json:"user_groups,omitempty"`
	Source                     string   `json:"user_source,omitempty"`
	Key                        string   `json:"userkey,omitempty"`
	Username                   string   `json:"username,omitempty"`
}

User is a user with its attributes.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL