Documentation ¶
Overview ¶
Package netskope is an API client developed in GO for use with the Netskope v2 APIs. The client was developed for and is used by the (Netskope Terraform Provider) https://github.com/ns-sbrown/terraform-provider-netskope.
Requirements ¶
- (Go) https://golang.org/doc/install >= 1.18
Usage
package main import ( "fmt" "os" "github.com/netskopeoss/netskope-api-client-go/netskope" ) func main() { //Init a client instance nsclient := netskope.NewClient(os.Getenv("NS_BaseURL"), os.Getenv("NS_ApiToken")) //Get Publishers pubs, err := nsclient.GetPublishers() if err != nil { fmt.Println(err) return } fmt.Println(pubs) }
Index ¶
- type Assessment
- type Client
- func (c *Client) CreateIpsecTunnel(ipsectunnel NewIpsecTunnel) (interface{}, error)
- func (c *Client) CreatePrivateApp(privateapp PrivateApp) (*PrivateApp, error)
- func (c *Client) CreatePublisher(options PublisherOptions) (*Publisher, error)
- func (c *Client) CreatePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*PublisherUpgradeProfile, error)
- func (c *Client) DeleteIpsecTunnel(options RequestOptions) (interface{}, error)
- func (c *Client) DeletePrivateApp(options PrivateAppOptions) (*successResponse, error)
- func (c *Client) DeletePublisher(options PublisherOptions) (*successResponse, error)
- func (c *Client) DeletePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*successResponse, error)
- func (c *Client) GetIpsecPopId(options RequestOptions) (*IpsecPops, error)
- func (c *Client) GetIpsecPops() (*IpsecPops, error)
- func (c *Client) GetIpsecPopsWithFilters(filters PopFilters) (*IpsecPops, error)
- func (c *Client) GetIpsecTunnelId(options RequestOptions) (*IpsecTunnels, error)
- func (c *Client) GetIpsecTunnels() (*IpsecTunnels, error)
- func (c *Client) GetPrivateAppId(options PrivateAppOptions) (interface{}, error)
- func (c *Client) GetPrivateApps() (interface{}, error)
- func (c *Client) GetPrivateAppsWithFilter(filter string) (interface{}, error)
- func (c *Client) GetPublisherId(options PublisherOptions) (*Publisher, error)
- func (c *Client) GetPublisherUpgradeProfileId(options PublisherUpgradeProfileOptions) (*successResponse, error)
- func (c *Client) GetPublisherUpgradeProfiles() (interface{}, error)
- func (c *Client) GetPublishers() (interface{}, error)
- func (c *Client) GetPublishersWithFilter(filter string) (interface{}, error)
- func (c *Client) GetToken(options PublisherOptions) (*PublisherToken, error)
- func (c *Client) ReplacePrivateApp(options PrivateAppOptions, privateapp PrivateApp) (*PrivateApp, error)
- func (c *Client) ReplacePublisher(options PublisherOptions) (interface{}, error)
- func (c *Client) UpdateIpsecTunnel(options RequestOptions, ipsectunnel NewIpsecTunnel) (interface{}, error)
- func (c *Client) UpdatePrivateApp(options PrivateAppOptions, privateapp PrivateApp) (*PrivateApp, error)
- func (c *Client) UpdatePublisher(options PublisherOptions) (interface{}, error)
- func (c *Client) UpdatePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*PublisherUpgradeProfile, error)
- type Config
- type IpsecOptions
- type IpsecPhase1
- type IpsecPhase2
- type IpsecPops
- type IpsecTunnel
- type IpsecTunnels
- type NewIpsecTunnel
- type PopFilters
- type PrivateApp
- type PrivateAppOptions
- type PrivateAppTags
- type PrivateAppsList
- type Protocol
- type Publisher
- type PublisherIdentity
- type PublisherOptions
- type PublisherToken
- type PublisherUpgradeProfile
- type PublisherUpgradeProfileOptions
- type PublisherUpgradeProfiles
- type PublishersList
- type RequestOptions
- type RetryConfig
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assessment ¶
type Assessment struct { EeeSupport bool `json:"eee_support"` HddFree string `json:"hdd_free"` HddTotal string `json:"hdd_total"` IPAddress string `json:"ip_address"` Version string `json:"version"` }
Assessment is a struct used inside of the Publisher struct. BUG(terraform-provider-netskope): Need tp modify EeeSupport so it isn't returned in JSON.
type Client ¶
type Client struct { BaseURL string HttpClient *http.Client // contains filtered or unexported fields }
The client struct defines a new HttpClient with the required connection details. BaseURL is a string that represents the Netskope tenant URL. (i.e. "https://example-tenant.goskope.com") apiToken is a string that represents the Netskope API v2 Token.
func NewClient ¶
The NewClient function accepts the BaseURL and apiToken and returns a client struct.
func NewRetryClient ¶ added in v0.3.0
The NewRetryClient function accepts the BaseURL and apiToken and returns a retryableclient. Use this in place of NewClient to enable automatic retry logic for rate limiting etc.
func (*Client) CreateIpsecTunnel ¶
func (c *Client) CreateIpsecTunnel(ipsectunnel NewIpsecTunnel) (interface{}, error)
CreateIpsecTunnel defines a function to create a new IPSec Tunnel in a Netskope tennant.
func (*Client) CreatePrivateApp ¶
func (c *Client) CreatePrivateApp(privateapp PrivateApp) (*PrivateApp, error)
func (*Client) CreatePublisher ¶
func (c *Client) CreatePublisher(options PublisherOptions) (*Publisher, error)
func (*Client) CreatePublisherUpgradeProfile ¶ added in v0.3.6
func (c *Client) CreatePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*PublisherUpgradeProfile, error)
func (*Client) DeleteIpsecTunnel ¶
func (c *Client) DeleteIpsecTunnel(options RequestOptions) (interface{}, error)
DeleteIpsecTunnel defines a function to create a new IPSec Tunnel in a Netskope tennant.
func (*Client) DeletePrivateApp ¶
func (c *Client) DeletePrivateApp(options PrivateAppOptions) (*successResponse, error)
func (*Client) DeletePublisher ¶
func (c *Client) DeletePublisher(options PublisherOptions) (*successResponse, error)
func (*Client) DeletePublisherUpgradeProfile ¶ added in v0.3.6
func (c *Client) DeletePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*successResponse, error)
func (*Client) GetIpsecPopId ¶
func (c *Client) GetIpsecPopId(options RequestOptions) (*IpsecPops, error)
GetIpsecPopId function is used to GET an individual Pop by ID.
func (*Client) GetIpsecPops ¶
func (*Client) GetIpsecPopsWithFilters ¶ added in v0.2.3
func (c *Client) GetIpsecPopsWithFilters(filters PopFilters) (*IpsecPops, error)
func (*Client) GetIpsecTunnelId ¶
func (c *Client) GetIpsecTunnelId(options RequestOptions) (*IpsecTunnels, error)
GetIpsecTunnelId function is used to GET an individual Tunnel by ID.
func (*Client) GetIpsecTunnels ¶
func (c *Client) GetIpsecTunnels() (*IpsecTunnels, error)
GetIpsecTunnels defines a function to get a list of IPSec Tunnels from a Netskope tenant.
func (*Client) GetPrivateAppId ¶
func (c *Client) GetPrivateAppId(options PrivateAppOptions) (interface{}, error)
func (*Client) GetPrivateApps ¶
func (*Client) GetPrivateAppsWithFilter ¶ added in v0.2.1
func (*Client) GetPublisherId ¶
func (c *Client) GetPublisherId(options PublisherOptions) (*Publisher, error)
GetPublisherId function is used to build API request which is sent to sendRequest(). It is called using the client struct, takes and returns an interface.
func (*Client) GetPublisherUpgradeProfileId ¶ added in v0.3.6
func (c *Client) GetPublisherUpgradeProfileId(options PublisherUpgradeProfileOptions) (*successResponse, error)
func (*Client) GetPublisherUpgradeProfiles ¶ added in v0.3.6
func (*Client) GetPublishers ¶
GetPublishers function is used to build API request which is sent to sendRequest(). It is called using the client struct, and returns an interface with a list of Publishers. The interface can be marshaled into the PublishersList struct.
BUG(terraform-provider-netskope): Need tp modify the Assessment struct so that this request can return a PublishersList struct instead of an interface.
func (*Client) GetPublishersWithFilter ¶ added in v0.2.1
GetPublishersWithFilters function is used to build API request which is sent to sendRequest(). It is called using the client struct and the NpaFilters Struct. It returns an interface with a list of Filtered Publishers. The interface can be marshaled into the PublishersList struct.
BUG(terraform-provider-netskope): Need tp modify the Assessment struct so that this request can return a PublishersList struct instead of an interface.
func (*Client) GetToken ¶
func (c *Client) GetToken(options PublisherOptions) (*PublisherToken, error)
func (*Client) ReplacePrivateApp ¶
func (c *Client) ReplacePrivateApp(options PrivateAppOptions, privateapp PrivateApp) (*PrivateApp, error)
func (*Client) ReplacePublisher ¶
func (c *Client) ReplacePublisher(options PublisherOptions) (interface{}, error)
func (*Client) UpdateIpsecTunnel ¶
func (c *Client) UpdateIpsecTunnel(options RequestOptions, ipsectunnel NewIpsecTunnel) (interface{}, error)
UpdateIpsecTunnel defines a function to create a new IPSec Tunnel in a Netskope tennant.
func (*Client) UpdatePrivateApp ¶
func (c *Client) UpdatePrivateApp(options PrivateAppOptions, privateapp PrivateApp) (*PrivateApp, error)
func (*Client) UpdatePublisher ¶
func (c *Client) UpdatePublisher(options PublisherOptions) (interface{}, error)
func (*Client) UpdatePublisherUpgradeProfile ¶ added in v0.3.6
func (c *Client) UpdatePublisherUpgradeProfile(options PublisherUpgradeProfileOptions) (*PublisherUpgradeProfile, error)
type Config ¶ added in v0.3.1
type Config struct { BaseURL string ApiToken string RetryConfig *RetryConfig }
type IpsecOptions ¶
type IpsecOptions struct { Phase1 IpsecPhase1 `json:"phase1"` Phase2 IpsecPhase2 `json:"phase2"` }
IpsecOptions Defines a struct to use return IPSec tunnel options.
type IpsecPhase1 ¶
type IpsecPhase1 struct { Dhgroup string `json:"dhgroup"` Dpd bool `json:"-"` Encryptionalgo string `json:"encryptionalgo"` Ikeversion string `json:"ikeversion"` Integrityalgo string `json:"integrityalgo"` Salifetime string `json:"salifetime"` }
IpsecPhase1 Defines a struct used to return Phase 1 tunnel options.
type IpsecPhase2 ¶
type IpsecPhase2 struct { Dhgroup string `json:"dhgroup"` Encryptionalgo string `json:"encryptionalgo"` Integrityalgo string `json:"integrityalgo"` Pfs bool `json:"-"` Salifetime string `json:"salifetime"` }
IpsecPhase2 Defines a struct used to return Phase 2 tunnel options.
type IpsecPops ¶
type IpsecPops []struct { Gateway string `json:"gateway"` ID string `json:"id"` Location string `json:"location"` Name string `json:"name"` Options IpsecOptions `json:"options"` Probeip string `json:"probeip"` Region string `json:"region"` }
IpsecPops defines a struct used for list of Netskope IPSec PoPs returned from the tenant.
type IpsecTunnel ¶
type IpsecTunnel struct { ID int `json:"id"` Site string `json:"site"` Enabled bool `json:"enabled"` Pops []struct { Name string `json:"name"` Gateway string `json:"gateway"` Probeip string `json:"probeip"` Primary bool `json:"primary"` } `json:"pops"` Status struct { Status string `json:"status"` Since string `json:"since"` Throughput string `json:"throughput"` } `json:"status"` Template string `json:"template"` Sourcetype string `json:"sourcetype"` Notes string `json:"notes"` Encryption string `json:"encryption"` Srcidentity string `json:"srcidentity"` Srcipidentity string `json:"srcipidentity"` }
type IpsecTunnels ¶
type IpsecTunnels []struct { ID int `json:"id"` Site string `json:"site"` Enabled bool `json:"enabled"` Pops []struct { Name string `json:"name"` Gateway string `json:"gateway"` Probeip string `json:"probeip"` Primary bool `json:"primary"` } `json:"pops"` Status struct { Status string `json:"status"` Since string `json:"since"` Throughput string `json:"throughput"` } `json:"status"` Template string `json:"template"` Sourcetype string `json:"sourcetype"` Notes string `json:"notes"` Encryption string `json:"encryption"` Srcidentity string `json:"srcidentity"` Srcipidentity string `json:"srcipidentity"` }
IpsecTunnels defines a struct to return a list of IPSec tunnels.
type NewIpsecTunnel ¶
type NewIpsecTunnel struct { Encryption string `json:"encryption,omitempty"` Site string `json:"site,omitempty"` Srcidentity string `json:"srcidentity,omitempty"` Srcipidentity string `json:"srcipidentity,omitempty"` Psk string `json:"psk,omitempty"` Notes string `json:"notes,omitempty"` Sourcetype string `json:"sourcetype,omitempty"` //['User', 'Server', 'IoT', 'Guest wifi', 'Mixed'] Pops []interface{} `json:"pops,omitempty"` Bandwidth int `json:"bandwidth,omitempty"` //[50, 100, 150, 250] Enable bool `json:"enable,omitempty"` }
NewIpsecTunnel defines a struct for creating an IPSec tunnel in Netskope.
type PopFilters ¶ added in v0.2.3
type PopFilters struct { Name string `url:"name,omitempty" validate:"excluded_with=Region Country Lat Long Ip Fields"` Region string `url:"region,omitempty" validate:"excluded_with=Name Country Lat Long Ip Fields"` Country string `url:"country,omitempty" validate:"excluded_with=Name Region Lat Long Ip Fields"` Lat string `url:"lat,omitempty" validate:"required_with=Long,excluded_with=Name Region Country Ip Fields"` Long string `url:"long,omitempty" validate:"required_with=Lat,excluded_with=Name Region Country Ip Fields"` Ip string `url:"ip,omitempty" validate:"excluded_with=Name Region Country Lat Long Fields"` Fields string `url:"fields,omitempty" validate:"excluded_with=Name Region Country Lat Long Ip"` Offset int `url:"offset,omitempty"` Limit int `url:"limit,omitempty"` }
type PrivateApp ¶
type PrivateApp struct { AppName string `json:"app_name"` Id int `json:"id",omitempty` Host string `json:"host"` Protocols []Protocol `json:"protocols"` Publishers []PublisherIdentity `json:"publishers,omitempty"` Tags []PrivateAppTags `json:"tags,omitempty"` UsePublisherDNS bool `json:"use_publisher_dns,omitempty"` ClientlessAccess bool `json:"clientless_access,omitempty"` TrustSelfSignedCerts bool `json:"trust_self_signed_certs,omitempty"` }
type PrivateAppOptions ¶
type PrivateAppTags ¶ added in v0.2.3
type PrivateAppTags struct {
TagName string `json:"tag_name"`
}
type PrivateAppsList ¶
type PrivateAppsList struct { PrivateApps []struct { AppID int `json:"app_id"` AppName string `json:"app_name"` ClientlessAccess bool `json:"clientless_access"` Host string `json:"host"` PrivateAppProtocol string `json:"private_app_protocol"` Protocols []struct { CreatedAt time.Time `json:"created_at"` ID int `json:"id"` Port string `json:"port"` ServiceID int `json:"service_id"` Transport string `json:"transport"` UpdatedAt time.Time `json:"updated_at"` } `json:"protocols"` Reachability struct { ErrorCode int `json:"-"` ErrorString string `json:"-"` Reachable bool `json:"reachable"` } `json:"reachability"` //Reachability interface{} `json:"-"` ServicePublisherAssignments []struct { Primary string `json:"primary"` PublisherID int `json:"publisher_id"` //Reachability string `json:"reachability"` Reachability struct { ErrorCode int `json:"-"` ErrorString string `json:"-"` Reachable bool `json:"reachable"` } `json:"reachability"` ServiceID int `json:"service_id"` } `json:"service_publisher_assignments"` TrustSelfSignedCerts bool `json:"trust_self_signed_certs"` UsePublisherDNS bool `json:"use_publisher_dns"` } `json:"private_apps"` }
type PublisherIdentity ¶
type PublisherOptions ¶
type PublisherOptions struct { Name string `json:"name,omitempty"` Id string `json:"id,omitempty"` Lbrokerconnect bool `json:"lbrokerconnect,omitempty"` PublisherUpgradeProfilesID int `json:"publisher_upgrade_profiles_id,omitempty"` Tags []struct { TagName string `json:"tag_name"` } `json:"tags,omitempty"` }
PublisherOptions struct defines details used in GET by ID, Create, Update and Delete methods.
- Name: a string that represents the publisher name
- Id: a string that represents the publisher Id
newpublisher := nsgo.PublisherOptions{ Name: "MyNewPublisher", } updatepublisher := nsgo.PublisherOptions{ Id: "987", }
type PublisherToken ¶
type PublisherToken struct {
Token string `json:"token"`
}
PublisherToken struct is used to define the token response data.
type PublisherUpgradeProfile ¶ added in v0.3.6
type PublisherUpgradeProfile struct { CreatedAt string `json:"created_at"` DockerTag string `json:"docker_tag"` Enabled bool `json:"enabled"` Frequency string `json:"frequency"` ID int `json:"id"` Name string `json:"name"` NextUpdateTime int `json:"next_update_time"` ReleaseType string `json:"release_type"` Timezone string `json:"timezone"` UpdatedAt string `json:"updated_at"` UpgradingStage int `json:"upgrading_stage"` WillStart bool `json:"will_start"` }
type PublisherUpgradeProfileOptions ¶ added in v0.3.6
type PublisherUpgradeProfileOptions struct { ExternalID string `json:"external_id,omitempty"` // Used when deleting a publisher upgrade profile ID string `json:"id,omitempty"` // Used when deleting a publisher upgrade profile Name string `json:"name,omitempty"` // Used when creating a publisher upgrade profile Timezone string `json:"timezone,omitempty"` // Used when creating a publisher upgrade profile ReleaseType string `json:"release_type,omitempty"` // Used when creating a publisher upgrade profile DockerTag string `json:"docker_tag,omitempty"` // Used when creating a publisher upgrade profile Frequency string `json:"frequency,omitempty"` // Used when creating a publisher upgrade profile Enabled bool `json:"enabled,omitempty"` // Used when creating a publisher upgrade profile }
type PublisherUpgradeProfiles ¶ added in v0.3.6
type PublisherUpgradeProfiles struct { UpgradeProfiles []struct { CreatedAt string `json:"created_at"` DockerTag string `json:"docker_tag"` Enabled bool `json:"enabled"` ExternalID int `json:"external_id"` Frequency string `json:"frequency"` ID int `json:"id"` Name string `json:"name"` NextUpdateTime int `json:"next_update_time"` NumAssociatedPublisher int `json:"num_associated_publisher"` ReleaseType string `json:"release_type"` Timezone string `json:"timezone"` UpdatedAt string `json:"updated_at"` UpgradingStage int `json:"upgrading_stage"` WillStart bool `json:"will_start"` } `json:"upgrade_profiles"` }
type PublishersList ¶
type PublishersList struct { Publishers []struct { Assessment struct { EeeSupport string `json:"eee_support"` HddFree string `json:"hdd_free"` HddTotal string `json:"hdd_total"` IPAddress string `json:"ip_address"` Latency string `json:"latency"` Version string `json:"version"` } `json:"assessment"` CommonName string `json:"common_name"` Lbrokerconnect bool `json:"lbrokerconnect"` PublisherID int `json:"publisher_id"` PublisherName string `json:"publisher_name"` PublisherUpgradeProfilesExternalID int `json:"publisher_upgrade_profiles_external_id"` Registered bool `json:"registered"` Status string `json:"status"` StitcherID int `json:"stitcher_id"` Tags []string `json:"tags"` UpgradeFailedReason struct { Detail string `json:"detail"` ErrorCode string `json:"error_code"` Timestamp string `json:"timestamp"` Version string `json:"version"` } `json:"upgrade_failed_reason"` UpgradeRequest bool `json:"upgrade_request"` UpgradeStatus struct { StatusFailureCode string `json:"status_failure_code"` Upstat string `json:"upstat"` } `json:"upgrade_status,omitempty"` } `json:"publishers"` }
type RequestOptions ¶
RequestOptions defines a struct to pass options to functions.
type RetryConfig ¶ added in v0.3.0
Notes ¶
Bugs ¶
Need tp modify EeeSupport so it isn't returned in JSON.
Need tp modify the Assessment struct so that this request can return a PublishersList struct instead of an interface.
Need tp modify the Assessment struct so that this request can return a PublishersList struct instead of an interface.