github.com/cyverse/go-irodsclient@v0.13.2/irods/types/ticket.go (about) 1 package types 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 // TicketType determines ticket access type 9 type TicketType string 10 11 const ( 12 // TicketTypeRead is for read 13 TicketTypeRead TicketType = "read" 14 // TicketTypeWrite is for write 15 TicketTypeWrite TicketType = "write" 16 ) 17 18 // IRODSTicket contains irods ticket information 19 type IRODSTicket struct { 20 ID int64 21 // Name is ticket string 22 Name string 23 // Type is access type 24 Type TicketType 25 // Owner has the owner's name 26 Owner string 27 // OwnerZone has the owner's zone 28 OwnerZone string 29 // ObjectType is type of object 30 ObjectType ObjectType 31 // Path is path to the object 32 Path string 33 // ExpirationTime is time that the ticket expires 34 ExpirationTime time.Time 35 // UsesLimit is an access limit 36 UsesLimit int64 37 // UsesCount is an access count 38 UsesCount int64 39 // WriteFileLimit is a write file limit 40 WriteFileLimit int64 41 // WriteFileCount is a write file count 42 WriteFileCount int64 43 // WriteByteLimit is a write byte limit 44 WriteByteLimit int64 45 // WriteByteCount is a write byte count 46 WriteByteCount int64 47 } 48 49 // IsReadWrite returns true if the ticket is TicketTypeWrite 50 func (ticket *IRODSTicket) IsReadWrite() bool { 51 return ticket.Type == TicketTypeWrite 52 } 53 54 // ToString stringifies the object 55 func (ticket *IRODSTicket) ToString() string { 56 return fmt.Sprintf("<IRODSTicket %d %s %s %s %s>", ticket.ID, ticket.Name, ticket.Owner, ticket.OwnerZone, ticket.Path) 57 } 58 59 // IRODSTicketForAnonymousAccess contains minimal irods ticket information for anonymous access 60 type IRODSTicketForAnonymousAccess struct { 61 ID int64 62 // Name is ticket string 63 Name string 64 // Type is access type 65 Type TicketType 66 // Path is path to the object 67 Path string 68 // ExpirationTime is time that the ticket expires 69 ExpirationTime time.Time 70 } 71 72 // ToString stringifies the object 73 func (ticket *IRODSTicketForAnonymousAccess) ToString() string { 74 return fmt.Sprintf("<IRODSTicketForAnonymousAccess %d %s %s %s %v>", ticket.ID, ticket.Name, ticket.Type, ticket.Path, ticket.ExpirationTime) 75 }