Backups generates a resource string for the given classes. If the backend is an empty string, it defaults to "*". Parameters: - class: the class name (string) Returns: - A string representing the resource path for the given classes. Example outputs: - "backups/*" if the backend is an empty string -
(classes ...string)
| 546 | // - "backups/*" if the backend is an empty string |
| 547 | // - "backups/{backend}" for the provided backend |
| 548 | func Backups(classes ...string) []string { |
| 549 | classes = schema.UppercaseClassesNames(classes...) |
| 550 | if len(classes) == 0 || (len(classes) == 1 && (classes[0] == "" || classes[0] == "*")) { |
| 551 | return []string{fmt.Sprintf("%s/collections/*", BackupsDomain)} |
| 552 | } |
| 553 | |
| 554 | resources := make([]string, len(classes)) |
| 555 | for idx := range classes { |
| 556 | if classes[idx] == "" { |
| 557 | resources[idx] = fmt.Sprintf("%s/collections/*", BackupsDomain) |
| 558 | } else { |
| 559 | resources[idx] = fmt.Sprintf("%s/collections/%s", BackupsDomain, classes[idx]) |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | return resources |
| 564 | } |
| 565 | |
| 566 | // Replications generates a replication resource string for a given class and shard. |
| 567 | // |
searching dependent graphs…