Guest User

Untitled

a guest
Jul 6th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // Irods implements minio.Gateway.
  2. type Irods struct {
  3. host string
  4. port int
  5. zone string
  6. colPath string
  7. user string
  8. pass string
  9. }
  10.  
  11. // NewGatewayLayer initializes GoRODS client and returns iRODS-backed minio.ObjectLayer interface
  12. func (g *Irods) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error) {
  13.  
  14. rodsCon, conErr := gorods.NewConnection(&gorods.ConnectionOptions{
  15. Type: gorods.UserDefined,
  16.  
  17. Host: g.host,
  18. Port: g.port,
  19. Zone: g.zone,
  20.  
  21. Username: creds.AccessKey,
  22. Password: creds.SecretKey,
  23. })
  24. if conErr != nil {
  25. return nil, conErr
  26. }
  27.  
  28. col, err := rodsCon.Collection(gorods.CollectionOptions{
  29. Path: g.colPath,
  30. })
  31. if err != nil {
  32. return nil, err
  33. }
  34.  
  35. return &irodsObjects{
  36. col: col,
  37. }, nil
  38. }
Add Comment
Please, Sign In to add comment