github.com/cyverse/go-irodsclient@v0.13.2/examples/version/version.go (about) 1 package main 2 3 import ( 4 "flag" 5 "fmt" 6 "os" 7 "time" 8 9 "github.com/cyverse/go-irodsclient/irods/connection" 10 "github.com/cyverse/go-irodsclient/irods/types" 11 12 log "github.com/sirupsen/logrus" 13 ) 14 15 func main() { 16 logger := log.WithFields(log.Fields{ 17 "package": "main", 18 "function": "main", 19 }) 20 21 // Parse cli parameters 22 flag.Parse() 23 24 // Read account configuration from YAML file 25 yaml, err := os.ReadFile("account.yml") 26 if err != nil { 27 logger.Error(err) 28 panic(err) 29 } 30 31 account, err := types.CreateIRODSAccountFromYAML(yaml) 32 if err != nil { 33 logger.Error(err) 34 panic(err) 35 } 36 37 logger.Debugf("Account : %v", account.MaskSensitiveData()) 38 39 // Create a file system 40 appName := "version" 41 42 conn := connection.NewIRODSConnection(account, 5*time.Minute, appName) 43 conn.Connect() 44 defer conn.Disconnect() 45 46 ver := conn.GetVersion() 47 48 fmt.Printf("API Version: %s\n", ver.APIVersion) 49 fmt.Printf("Release Version: %s\n", ver.ReleaseVersion) 50 }