IsValid checks if the promotion token is valid or returns an error otherwise
()
| 207 | // IsValid checks if the promotion token is valid or |
| 208 | // returns an error otherwise |
| 209 | func (token *PgControldataTokenContent) IsValid() error { |
| 210 | if len(token.LatestCheckpointTimelineID) == 0 { |
| 211 | return ErrEmptyLatestCheckpointTimelineID |
| 212 | } |
| 213 | |
| 214 | if len(token.REDOWALFile) == 0 { |
| 215 | return ErrEmptyREDOWALFile |
| 216 | } |
| 217 | |
| 218 | if len(token.DatabaseSystemIdentifier) == 0 { |
| 219 | return ErrEmptyDatabaseSystemIdentifier |
| 220 | } |
| 221 | |
| 222 | if len(token.LatestCheckpointREDOLocation) == 0 { |
| 223 | return ErrEmptyLatestCheckpointREDOLocation |
| 224 | } |
| 225 | |
| 226 | if len(token.TimeOfLatestCheckpoint) == 0 { |
| 227 | return ErrEmptyTimeOfLatestCheckpoint |
| 228 | } |
| 229 | |
| 230 | if len(token.OperatorVersion) == 0 { |
| 231 | return ErrEmptyOperatorVersion |
| 232 | } |
| 233 | |
| 234 | return nil |
| 235 | } |
| 236 | |
| 237 | // Encode encodes the token content into a base64 string |
| 238 | func (token *PgControldataTokenContent) Encode() (string, error) { |