github.com/osievert/jfrog-cli-core@v1.2.7/artifactory/spec/builder.go (about) 1 package spec 2 3 import "strconv" 4 5 type builder struct { 6 pattern string 7 // Deprecated, use Exclusions instead 8 excludePatterns []string 9 exclusions []string 10 target string 11 explode string 12 props string 13 excludeProps string 14 sortOrder string 15 sortBy []string 16 offset int 17 limit int 18 build string 19 excludeArtifacts bool 20 includeDeps bool 21 bundle string 22 recursive bool 23 flat bool 24 regexp bool 25 includeDirs bool 26 archiveEntries string 27 validateSymlinks bool 28 } 29 30 func NewBuilder() *builder { 31 return &builder{} 32 } 33 34 func (b *builder) Pattern(pattern string) *builder { 35 b.pattern = pattern 36 return b 37 } 38 39 func (b *builder) ArchiveEntries(archiveEntries string) *builder { 40 b.archiveEntries = archiveEntries 41 return b 42 } 43 44 func (b *builder) ExcludePatterns(excludePatterns []string) *builder { 45 b.excludePatterns = excludePatterns 46 return b 47 } 48 49 func (b *builder) Exclusions(exclusions []string) *builder { 50 b.exclusions = exclusions 51 return b 52 } 53 54 func (b *builder) Target(target string) *builder { 55 b.target = target 56 return b 57 } 58 59 func (b *builder) Explode(explode string) *builder { 60 b.explode = explode 61 return b 62 } 63 64 func (b *builder) Props(props string) *builder { 65 b.props = props 66 return b 67 } 68 69 func (b *builder) ExcludeProps(excludeProps string) *builder { 70 b.excludeProps = excludeProps 71 return b 72 } 73 74 func (b *builder) SortOrder(sortOrder string) *builder { 75 b.sortOrder = sortOrder 76 return b 77 } 78 79 func (b *builder) SortBy(sortBy []string) *builder { 80 b.sortBy = sortBy 81 return b 82 } 83 84 func (b *builder) Offset(offset int) *builder { 85 b.offset = offset 86 return b 87 } 88 89 func (b *builder) Limit(limit int) *builder { 90 b.limit = limit 91 return b 92 } 93 94 func (b *builder) Build(build string) *builder { 95 b.build = build 96 return b 97 } 98 99 func (b *builder) ExcludeArtifacts(excludeArtifacts bool) *builder { 100 b.excludeArtifacts = excludeArtifacts 101 return b 102 } 103 104 func (b *builder) IncludeDeps(includeDeps bool) *builder { 105 b.includeDeps = includeDeps 106 return b 107 } 108 109 func (b *builder) Bundle(bundle string) *builder { 110 b.bundle = bundle 111 return b 112 } 113 114 func (b *builder) Recursive(recursive bool) *builder { 115 b.recursive = recursive 116 return b 117 } 118 119 func (b *builder) Flat(flat bool) *builder { 120 b.flat = flat 121 return b 122 } 123 124 func (b *builder) Regexp(regexp bool) *builder { 125 b.regexp = regexp 126 return b 127 } 128 129 func (b *builder) IncludeDirs(includeDirs bool) *builder { 130 b.includeDirs = includeDirs 131 return b 132 } 133 134 func (b *builder) ValidateSymlinks(validateSymlinks bool) *builder { 135 b.validateSymlinks = validateSymlinks 136 return b 137 } 138 139 func (b *builder) BuildSpec() *SpecFiles { 140 return &SpecFiles{ 141 Files: []File{ 142 { 143 Pattern: b.pattern, 144 // Deprecated, use Exclusions instead 145 ExcludePatterns: b.excludePatterns, 146 Exclusions: b.exclusions, 147 Target: b.target, 148 Props: b.props, 149 ExcludeProps: b.excludeProps, 150 SortOrder: b.sortOrder, 151 SortBy: b.sortBy, 152 Offset: b.offset, 153 Limit: b.limit, 154 Build: b.build, 155 Bundle: b.bundle, 156 Explode: b.explode, 157 ArchiveEntries: b.archiveEntries, 158 Recursive: strconv.FormatBool(b.recursive), 159 Flat: strconv.FormatBool(b.flat), 160 Regexp: strconv.FormatBool(b.regexp), 161 IncludeDirs: strconv.FormatBool(b.includeDirs), 162 ValidateSymlinks: strconv.FormatBool(b.validateSymlinks), 163 ExcludeArtifacts: strconv.FormatBool(b.excludeArtifacts), 164 IncludeDeps: strconv.FormatBool(b.includeDeps), 165 }, 166 }, 167 } 168 }