go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/apps/provider-scaffold/template/connection/connection.go.template (about)

     1  package connection
     2  
     3  import (
     4  	"go.mondoo.com/cnquery/providers-sdk/v1/inventory"
     5  )
     6  
     7  type {{ .CamelcaseProviderID }}Connection struct {
     8  	id       uint32
     9  	Conf     *inventory.Config
    10  	asset    *inventory.Asset
    11  	// Add custom connection fields here
    12  }
    13  
    14  func New{{ .CamelcaseProviderID }}Connection(id uint32, asset *inventory.Asset, conf *inventory.Config) (*{{ .CamelcaseProviderID }}Connection, error) {
    15  	conn := &{{ .CamelcaseProviderID }}Connection{
    16  		Conf:  conf,
    17  		id:    id,
    18  		asset: asset,
    19  	}
    20  
    21  	// initialize your connection here
    22  
    23  	return conn, nil
    24  }
    25  
    26  func (c *{{ .CamelcaseProviderID }}Connection) Name() string {
    27  	return "{{ .ProviderID }}"
    28  }
    29  
    30  func (c *{{ .CamelcaseProviderID }}Connection) ID() uint32 {
    31  	return c.id
    32  }
    33  
    34  func (c *{{ .CamelcaseProviderID }}Connection) Asset() *inventory.Asset {
    35  	return c.asset
    36  }
    37