🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

southwinds.dev/interlink-client

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

southwinds.dev/interlink-client

Go Modules
Version
v0.0.0-20221103181044-70fea51b1467
Version published
Created
Source

A go client for the Interlink Configuration Management Database HTTP API.

Usage

An example of how to use is below:

// import the library
package main 

import "southwinds.dev/interlink-client"

func main() {
    // prepares the client configuration
    cfg := &ilink.ClientConf{
         BaseURI:            "http://localhost:8080",
         InsecureSkipVerify: true,
         AuthMode:           ilink.Basic,
         Username:           "admin",
         Password:           "0n1x",
         // uncomment below & reset configuration vars
         // to test using an OAuth bearer token
         // AuthMode:           	OIDC,
         // TokenURI:     		"https://dev-447786.okta.com/oauth2/default/v1/token",
         // ClientId:			"0oalyh...356",
         // AppSecret:			"Tsed........OP0oEf9H7",
    }
    // create an instance of the web api client
    client, err := ilink.NewClient(cfg)

    if err != nil {
       panic(err)
    }

    // create a new model
    model := &ilink.Model {
        Key:         "test_model",
        Name:        "Test Model",
        Description: "Test Model",
    }

    // put the model
    result, err := client.PutModel(model)
    
    if err != nil {
       panic(err)
    }

    if result.Error {
        panic(result.Message)
    }
}

// create an instance of the client
func createClient() *ilink.Client {
    client, err := ilink.NewClient(&ilink.ClientConf{
        BaseURI:            "http://localhost:8080",
        InsecureSkipVerify: true,
        AuthMode:           ilink.Basic,
        Username:           "admin",
        Password:           "0n1x",
        // uncomment below & reset configuration vars
        // to test using an OAuth bearer token
        // AuthMode:           	OIDC,
        // TokenURI:     		"https://dev-447786.okta.com/oauth2/default/v1/token",
        // ClientId:			"0oalyh...356",
        // AppSecret:			"Tsed........OP0oEf9H7",
	})
	if err != nil { panic(err) }
	return client
}

More examples can be found here.

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts