|
64 | 64 | - [Create API Key](#create-api-key) |
65 | 65 | - [Regenerate API Key](#regenerate-api-key) |
66 | 66 | - [Get API Key](#get-api-key) |
| 67 | + - [Creating and Updating Multiple Repositories](#creating-and-updating-multiple-repositories) |
67 | 68 | - [Creating and Updating Local Repository](#creating-and-updating-local-repository) |
68 | 69 | - [Creating and Updating Remote Repository](#creating-and-updating-remote-repository) |
69 | 70 | - [Creating and Updating Virtual Repository](#creating-and-updating-virtual-repository) |
|
80 | 81 | - [Creating and Updating Permission Targets](#creating-and-updating-permission-targets) |
81 | 82 | - [Removing a Permission Target](#removing-a-permission-target) |
82 | 83 | - [Fetching a Permission Target](#fetching-a-permission-target) |
| 84 | + - [Fetching All Permission Targets](#fetching-all-permission-targets) |
83 | 85 | - [Fetching Artifactory's Version](#fetching-artifactorys-version) |
84 | 86 | - [Fetching Running Artifactory Nodes in a Cluster](#fetching-running-artifactory-nodes-in-a-cluster) |
85 | 87 | - [Fetching Artifactory's Service ID](#fetching-artifactorys-service-id) |
@@ -1081,6 +1083,150 @@ Updating federated Generic repository: |
1081 | 1083 | err = servicesManager.UpdateFederatedRepository().Generic(params) |
1082 | 1084 | ``` |
1083 | 1085 |
|
| 1086 | +#### Creating and Updating Multiple Repositories |
| 1087 | + |
| 1088 | +NOTE: |
| 1089 | +- Creating of multiple repositories is supported from Artifactory 7.84.3 and later versions. |
| 1090 | +- Updating of multiple repositories is supported from Artifactory 7.104.2 and later versions. |
| 1091 | + |
| 1092 | +You can create and update multiple repositories in a single batch operation using the `CreateUpdateRepositoriesInBatch` method. This method accepts a JSON byte array containing repository configurations and can handle mixed repository and package types within the same request. |
| 1093 | + |
| 1094 | +****Creating Multiple Repositories:**** |
| 1095 | + |
| 1096 | +```go |
| 1097 | +// Define repository configurations as JSON array |
| 1098 | +repositoriesConfig := `[ |
| 1099 | + { |
| 1100 | + "key": "maven-local-repo", |
| 1101 | + "rclass": "local", |
| 1102 | + "packageType": "maven", |
| 1103 | + "description": "Local Maven repository", |
| 1104 | + "repoLayoutRef": "maven-2-default" |
| 1105 | + }, |
| 1106 | + { |
| 1107 | + "key": "npm-remote-repo", |
| 1108 | + "rclass": "remote", |
| 1109 | + "packageType": "npm", |
| 1110 | + "description": "Remote NPM repository", |
| 1111 | + "url": "https://registry.npmjs.org/", |
| 1112 | + "repoLayoutRef": "npm-default" |
| 1113 | + } |
| 1114 | +]` |
| 1115 | + |
| 1116 | +// Create multiple repositories (isUpdate = false) |
| 1117 | +err = rtManager.CreateUpdateRepositoriesInBatch([]byte(repositoriesConfig), false) |
| 1118 | +if err != nil { |
| 1119 | + return err |
| 1120 | +} |
| 1121 | +``` |
| 1122 | + |
| 1123 | +**Updating Multiple Repositories:** |
| 1124 | + |
| 1125 | +```go |
| 1126 | +// Define update configurations as JSON |
| 1127 | +updateConfig := `[ |
| 1128 | + { |
| 1129 | + "key": "maven-local-repo", |
| 1130 | + "description": "Updated Maven local repository description", |
| 1131 | + "notes": "Updated internal notes" |
| 1132 | + }, |
| 1133 | + { |
| 1134 | + "key": "npm-remote-repo", |
| 1135 | + "description": "Updated NPM remote repository", |
| 1136 | + "retrievalCachePeriodSecs": 7200 |
| 1137 | + } |
| 1138 | +]` |
| 1139 | + |
| 1140 | +// Update multiple repositories (isUpdate = true) |
| 1141 | +err = rtManager.CreateUpdateRepositoriesInBatch([]byte(updateConfig), true) |
| 1142 | +if err != nil { |
| 1143 | + return err |
| 1144 | +} |
| 1145 | +``` |
| 1146 | + |
| 1147 | +**Configurations with mixed repository and package types:** |
| 1148 | + |
| 1149 | +```go |
| 1150 | +// configuration with different repository and package types |
| 1151 | +config := `[ |
| 1152 | + { |
| 1153 | + "key": "maven-local-prod", |
| 1154 | + "rclass": "local", |
| 1155 | + "packageType": "maven", |
| 1156 | + "description": "Production Maven artifacts", |
| 1157 | + "repoLayoutRef": "maven-2-default", |
| 1158 | + "archiveBrowsingEnabled": true, |
| 1159 | + "xrayIndex": true, |
| 1160 | + "includesPattern": "**/*", |
| 1161 | + "excludesPattern": "com/example/test/**" |
| 1162 | + }, |
| 1163 | + { |
| 1164 | + "key": "npm-remote-proxy", |
| 1165 | + "rclass": "remote", |
| 1166 | + "packageType": "npm", |
| 1167 | + "description": "NPM remote proxy", |
| 1168 | + "url": "https://registry.npmjs.org/", |
| 1169 | + "repoLayoutRef": "npm-default", |
| 1170 | + "retrievalCachePeriodSecs": 3600, |
| 1171 | + "assumedOfflinePeriodSecs": 300, |
| 1172 | + "missedRetrievalCachePeriodSecs": 1800 |
| 1173 | + }, |
| 1174 | + { |
| 1175 | + "key": "docker-virtual-all", |
| 1176 | + "rclass": "virtual", |
| 1177 | + "packageType": "docker", |
| 1178 | + "description": "All Docker repositories", |
| 1179 | + "repositories": ["docker-local-prod", "docker-remote-proxy"], |
| 1180 | + "repoLayoutRef": "simple-default", |
| 1181 | + "defaultDeploymentRepo": "docker-local-prod", |
| 1182 | + "artifactoryRequestsCanRetrieveRemoteArtifacts": true |
| 1183 | + }, |
| 1184 | + { |
| 1185 | + "key": "maven-federated-shared", |
| 1186 | + "rclass": "federated", |
| 1187 | + "packageType": "maven", |
| 1188 | + "description": "Federated Maven repository", |
| 1189 | + "repoLayoutRef": "maven-2-default", |
| 1190 | + "members": [ |
| 1191 | + { |
| 1192 | + "url": "http://artifactory2.company.com/artifactory/maven-federated-shared", |
| 1193 | + "enabled": true |
| 1194 | + }, |
| 1195 | + { |
| 1196 | + "url": "http://artifactory3.company.com/artifactory/maven-federated-shared", |
| 1197 | + "enabled": true |
| 1198 | + } |
| 1199 | + ] |
| 1200 | + } |
| 1201 | +]` |
| 1202 | + |
| 1203 | +// Create all repositories in a single batch operation |
| 1204 | +err = rtManager.CreateUpdateRepositoriesInBatch([]byte(config), false) |
| 1205 | +if err != nil { |
| 1206 | + return err |
| 1207 | +} |
| 1208 | +``` |
| 1209 | + |
| 1210 | +**Supported Repository Classes:** |
| 1211 | +- `local` - Local repositories for storing artifacts |
| 1212 | +- `remote` - Remote repositories for proxying external repositories |
| 1213 | +- `virtual` - Virtual repositories for aggregating multiple repositories |
| 1214 | +- `federated` - Federated repositories for cross-instance synchronization |
| 1215 | + |
| 1216 | +**Supported Package Types:** |
| 1217 | +Alpine, Bower, Cran, Cargo, Chef, Cocoapods, Composer, Conan, Conda, Debian, Docker, Gems, Generic, Gitlfs, Go, Gradle, Helm, Ivy, Maven, Npm, Nuget, Opkg, P2, Puppet, Pypi, Rpm, Sbt, Swift, Terraform, Vcs, Vagrant, and Yum. |
| 1218 | + |
| 1219 | +**Method Parameters:** |
| 1220 | +- `body []byte` - JSON byte array containing repository configurations |
| 1221 | +- `isUpdate bool` - Set to `false` for creating repositories, `true` for updating existing repositories |
| 1222 | + |
| 1223 | +**HTTP Details:** |
| 1224 | +- **Endpoint**: `/artifactory/api/v2/repositories/batch` |
| 1225 | +- **HTTP Method**: `PUT` for create operations, `POST` for update operations |
| 1226 | +- **Content-Type**: `application/json` |
| 1227 | +- **Authentication**: Requires admin privileges or appropriate repository permissions |
| 1228 | +- **Response**: Returns HTTP 201 for successful creation, HTTP 200 for successful updates |
| 1229 | + |
1084 | 1230 | #### Removing a Repository |
1085 | 1231 |
|
1086 | 1232 | You can remove a repository from Artifactory using its key: |
@@ -1278,6 +1424,12 @@ permissionTargetParams, err = servicesManager.GetPermissionTarget("java-develope |
1278 | 1424 | If the requested permission target does not exist, a nil value is returned for the _permissionTargetParams_ param, with |
1279 | 1425 | a nil error value |
1280 | 1426 |
|
| 1427 | +#### Fetching all Permission Targets |
| 1428 | + |
| 1429 | +```go |
| 1430 | +permissions, err = servicesManager.GetAllPermissionTargets() |
| 1431 | +``` |
| 1432 | + |
1281 | 1433 | #### Fetching Artifactory's Version |
1282 | 1434 |
|
1283 | 1435 | ```go |
@@ -3081,17 +3233,23 @@ resp, err := serviceManager.DeleteReleaseBundleVersionPromotion(rbDetails, query |
3081 | 3233 | #### Remote Delete Release Bundle |
3082 | 3234 |
|
3083 | 3235 | ```go |
| 3236 | +rbDetails := ReleaseBundleDetails{"rbName", "rbVersion"} |
| 3237 | + |
3084 | 3238 | rules := &distribution.DistributionCommonParams{ |
3085 | | - SiteName: "*", |
3086 | | - CityName: "*", |
3087 | | - CountryCodes: []string{"*"}, |
| 3239 | +SiteName: "*", |
| 3240 | +CityName: "*", |
| 3241 | +CountryCodes: []string{"*"}, |
3088 | 3242 | } |
3089 | 3243 | params := distribution.NewDistributeReleaseBundleParams("rbName", "rbVersion") |
3090 | 3244 | params.DistributionRules = append(params.DistributionRules, rules) |
3091 | 3245 |
|
3092 | | -dryRun := true |
| 3246 | +queryParams := CommonOptionalQueryParams{} |
| 3247 | +queryParams.ProjectKey = "project" |
| 3248 | +queryParams.Async = true |
3093 | 3249 |
|
3094 | | -resp, err := serviceManager.RemoteDeleteReleaseBundle(params, dryRun) |
| 3250 | +isNewReleaseBundleApiSupported=true |
| 3251 | +//From 7.63.2, isNewReleaseBundleApiSupported is true, below that version it should be false. |
| 3252 | +resp, err := serviceManager.RemoteDeleteReleaseBundle(rbDetails, params, isNewReleaseBundleApiSupported) |
3095 | 3253 | ``` |
3096 | 3254 |
|
3097 | 3255 | #### check-rb-exists |
|
0 commit comments