github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/rust/src/apis/internal_api.rs (about) 1 /* 2 * lakeFS API 3 * 4 * lakeFS HTTP API 5 * 6 * The version of the OpenAPI document: 1.0.0 7 * Contact: services@treeverse.io 8 * Generated by: https://openapi-generator.tech 9 */ 10 11 12 use reqwest; 13 14 use crate::{apis::ResponseContent, models}; 15 use super::{Error, configuration}; 16 17 18 /// struct for typed errors of method [`create_branch_protection_rule_preflight`] 19 #[derive(Debug, Clone, Serialize, Deserialize)] 20 #[serde(untagged)] 21 pub enum CreateBranchProtectionRulePreflightError { 22 Status401(models::Error), 23 Status404(models::Error), 24 Status409(models::Error), 25 Status420(), 26 DefaultResponse(models::Error), 27 UnknownValue(serde_json::Value), 28 } 29 30 /// struct for typed errors of method [`create_commit_record`] 31 #[derive(Debug, Clone, Serialize, Deserialize)] 32 #[serde(untagged)] 33 pub enum CreateCommitRecordError { 34 Status400(models::Error), 35 Status401(models::Error), 36 Status403(models::Error), 37 Status404(models::Error), 38 Status420(), 39 DefaultResponse(models::Error), 40 UnknownValue(serde_json::Value), 41 } 42 43 /// struct for typed errors of method [`create_symlink_file`] 44 #[derive(Debug, Clone, Serialize, Deserialize)] 45 #[serde(untagged)] 46 pub enum CreateSymlinkFileError { 47 Status401(models::Error), 48 Status404(models::Error), 49 Status420(), 50 DefaultResponse(models::Error), 51 UnknownValue(serde_json::Value), 52 } 53 54 /// struct for typed errors of method [`delete_repository_metadata`] 55 #[derive(Debug, Clone, Serialize, Deserialize)] 56 #[serde(untagged)] 57 pub enum DeleteRepositoryMetadataError { 58 Status401(models::Error), 59 Status420(), 60 DefaultResponse(models::Error), 61 UnknownValue(serde_json::Value), 62 } 63 64 /// struct for typed errors of method [`dump_refs`] 65 #[derive(Debug, Clone, Serialize, Deserialize)] 66 #[serde(untagged)] 67 pub enum DumpRefsError { 68 Status400(models::Error), 69 Status401(models::Error), 70 Status404(models::Error), 71 Status420(), 72 DefaultResponse(models::Error), 73 UnknownValue(serde_json::Value), 74 } 75 76 /// struct for typed errors of method [`get_auth_capabilities`] 77 #[derive(Debug, Clone, Serialize, Deserialize)] 78 #[serde(untagged)] 79 pub enum GetAuthCapabilitiesError { 80 Status420(), 81 DefaultResponse(models::Error), 82 UnknownValue(serde_json::Value), 83 } 84 85 /// struct for typed errors of method [`get_garbage_collection_config`] 86 #[derive(Debug, Clone, Serialize, Deserialize)] 87 #[serde(untagged)] 88 pub enum GetGarbageCollectionConfigError { 89 Status401(models::Error), 90 UnknownValue(serde_json::Value), 91 } 92 93 /// struct for typed errors of method [`get_lake_fs_version`] 94 #[derive(Debug, Clone, Serialize, Deserialize)] 95 #[serde(untagged)] 96 pub enum GetLakeFsVersionError { 97 Status401(models::Error), 98 UnknownValue(serde_json::Value), 99 } 100 101 /// struct for typed errors of method [`get_setup_state`] 102 #[derive(Debug, Clone, Serialize, Deserialize)] 103 #[serde(untagged)] 104 pub enum GetSetupStateError { 105 Status420(), 106 DefaultResponse(models::Error), 107 UnknownValue(serde_json::Value), 108 } 109 110 /// struct for typed errors of method [`get_storage_config`] 111 #[derive(Debug, Clone, Serialize, Deserialize)] 112 #[serde(untagged)] 113 pub enum GetStorageConfigError { 114 Status401(models::Error), 115 UnknownValue(serde_json::Value), 116 } 117 118 /// struct for typed errors of method [`get_usage_report_summary`] 119 #[derive(Debug, Clone, Serialize, Deserialize)] 120 #[serde(untagged)] 121 pub enum GetUsageReportSummaryError { 122 Status400(models::Error), 123 Status401(models::Error), 124 Status404(models::Error), 125 Status420(), 126 DefaultResponse(models::Error), 127 UnknownValue(serde_json::Value), 128 } 129 130 /// struct for typed errors of method [`internal_create_branch_protection_rule`] 131 #[derive(Debug, Clone, Serialize, Deserialize)] 132 #[serde(untagged)] 133 pub enum InternalCreateBranchProtectionRuleError { 134 Status401(models::Error), 135 Status404(models::Error), 136 Status420(), 137 DefaultResponse(models::Error), 138 UnknownValue(serde_json::Value), 139 } 140 141 /// struct for typed errors of method [`internal_delete_branch_protection_rule`] 142 #[derive(Debug, Clone, Serialize, Deserialize)] 143 #[serde(untagged)] 144 pub enum InternalDeleteBranchProtectionRuleError { 145 Status401(models::Error), 146 Status404(models::Error), 147 Status420(), 148 DefaultResponse(models::Error), 149 UnknownValue(serde_json::Value), 150 } 151 152 /// struct for typed errors of method [`internal_delete_garbage_collection_rules`] 153 #[derive(Debug, Clone, Serialize, Deserialize)] 154 #[serde(untagged)] 155 pub enum InternalDeleteGarbageCollectionRulesError { 156 Status401(models::Error), 157 Status404(models::Error), 158 Status420(), 159 DefaultResponse(models::Error), 160 UnknownValue(serde_json::Value), 161 } 162 163 /// struct for typed errors of method [`internal_get_branch_protection_rules`] 164 #[derive(Debug, Clone, Serialize, Deserialize)] 165 #[serde(untagged)] 166 pub enum InternalGetBranchProtectionRulesError { 167 Status401(models::Error), 168 Status404(models::Error), 169 Status420(), 170 DefaultResponse(models::Error), 171 UnknownValue(serde_json::Value), 172 } 173 174 /// struct for typed errors of method [`internal_get_garbage_collection_rules`] 175 #[derive(Debug, Clone, Serialize, Deserialize)] 176 #[serde(untagged)] 177 pub enum InternalGetGarbageCollectionRulesError { 178 Status401(models::Error), 179 Status404(models::Error), 180 Status420(), 181 DefaultResponse(models::Error), 182 UnknownValue(serde_json::Value), 183 } 184 185 /// struct for typed errors of method [`internal_set_garbage_collection_rules`] 186 #[derive(Debug, Clone, Serialize, Deserialize)] 187 #[serde(untagged)] 188 pub enum InternalSetGarbageCollectionRulesError { 189 Status401(models::Error), 190 Status404(models::Error), 191 Status420(), 192 DefaultResponse(models::Error), 193 UnknownValue(serde_json::Value), 194 } 195 196 /// struct for typed errors of method [`post_stats_events`] 197 #[derive(Debug, Clone, Serialize, Deserialize)] 198 #[serde(untagged)] 199 pub enum PostStatsEventsError { 200 Status400(models::Error), 201 Status401(models::Error), 202 Status420(), 203 DefaultResponse(models::Error), 204 UnknownValue(serde_json::Value), 205 } 206 207 /// struct for typed errors of method [`prepare_garbage_collection_commits`] 208 #[derive(Debug, Clone, Serialize, Deserialize)] 209 #[serde(untagged)] 210 pub enum PrepareGarbageCollectionCommitsError { 211 Status401(models::Error), 212 Status403(models::Error), 213 Status404(models::Error), 214 Status420(), 215 DefaultResponse(models::Error), 216 UnknownValue(serde_json::Value), 217 } 218 219 /// struct for typed errors of method [`prepare_garbage_collection_uncommitted`] 220 #[derive(Debug, Clone, Serialize, Deserialize)] 221 #[serde(untagged)] 222 pub enum PrepareGarbageCollectionUncommittedError { 223 Status400(models::Error), 224 Status401(models::Error), 225 Status403(models::Error), 226 Status404(models::Error), 227 Status420(), 228 DefaultResponse(models::Error), 229 UnknownValue(serde_json::Value), 230 } 231 232 /// struct for typed errors of method [`restore_refs`] 233 #[derive(Debug, Clone, Serialize, Deserialize)] 234 #[serde(untagged)] 235 pub enum RestoreRefsError { 236 Status400(models::Error), 237 Status401(models::Error), 238 Status404(models::Error), 239 Status420(), 240 DefaultResponse(models::Error), 241 UnknownValue(serde_json::Value), 242 } 243 244 /// struct for typed errors of method [`set_garbage_collection_rules_preflight`] 245 #[derive(Debug, Clone, Serialize, Deserialize)] 246 #[serde(untagged)] 247 pub enum SetGarbageCollectionRulesPreflightError { 248 Status401(models::Error), 249 Status404(models::Error), 250 Status420(), 251 DefaultResponse(models::Error), 252 UnknownValue(serde_json::Value), 253 } 254 255 /// struct for typed errors of method [`set_repository_metadata`] 256 #[derive(Debug, Clone, Serialize, Deserialize)] 257 #[serde(untagged)] 258 pub enum SetRepositoryMetadataError { 259 Status401(models::Error), 260 Status404(models::Error), 261 Status420(), 262 DefaultResponse(models::Error), 263 UnknownValue(serde_json::Value), 264 } 265 266 /// struct for typed errors of method [`setup`] 267 #[derive(Debug, Clone, Serialize, Deserialize)] 268 #[serde(untagged)] 269 pub enum SetupError { 270 Status400(models::Error), 271 Status409(models::Error), 272 Status420(), 273 DefaultResponse(models::Error), 274 UnknownValue(serde_json::Value), 275 } 276 277 /// struct for typed errors of method [`setup_comm_prefs`] 278 #[derive(Debug, Clone, Serialize, Deserialize)] 279 #[serde(untagged)] 280 pub enum SetupCommPrefsError { 281 Status409(models::Error), 282 Status412(models::Error), 283 Status420(), 284 DefaultResponse(models::Error), 285 UnknownValue(serde_json::Value), 286 } 287 288 /// struct for typed errors of method [`stage_object`] 289 #[derive(Debug, Clone, Serialize, Deserialize)] 290 #[serde(untagged)] 291 pub enum StageObjectError { 292 Status400(models::Error), 293 Status401(models::Error), 294 Status403(models::Error), 295 Status404(models::Error), 296 Status420(), 297 DefaultResponse(models::Error), 298 UnknownValue(serde_json::Value), 299 } 300 301 /// struct for typed errors of method [`upload_object_preflight`] 302 #[derive(Debug, Clone, Serialize, Deserialize)] 303 #[serde(untagged)] 304 pub enum UploadObjectPreflightError { 305 Status401(models::Error), 306 Status403(models::Error), 307 Status404(models::Error), 308 Status420(), 309 DefaultResponse(models::Error), 310 UnknownValue(serde_json::Value), 311 } 312 313 314 pub async fn create_branch_protection_rule_preflight(configuration: &configuration::Configuration, repository: &str) -> Result<(), Error<CreateBranchProtectionRulePreflightError>> { 315 let local_var_configuration = configuration; 316 317 let local_var_client = &local_var_configuration.client; 318 319 let local_var_uri_str = format!("{}/repositories/{repository}/branch_protection/set_allowed", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 320 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 321 322 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 323 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 324 } 325 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 326 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 327 }; 328 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 329 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 330 }; 331 332 let local_var_req = local_var_req_builder.build()?; 333 let local_var_resp = local_var_client.execute(local_var_req).await?; 334 335 let local_var_status = local_var_resp.status(); 336 let local_var_content = local_var_resp.text().await?; 337 338 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 339 Ok(()) 340 } else { 341 let local_var_entity: Option<CreateBranchProtectionRulePreflightError> = serde_json::from_str(&local_var_content).ok(); 342 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 343 Err(Error::ResponseError(local_var_error)) 344 } 345 } 346 347 pub async fn create_commit_record(configuration: &configuration::Configuration, repository: &str, commit_record_creation: models::CommitRecordCreation) -> Result<(), Error<CreateCommitRecordError>> { 348 let local_var_configuration = configuration; 349 350 let local_var_client = &local_var_configuration.client; 351 352 let local_var_uri_str = format!("{}/repositories/{repository}/commits", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 353 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 354 355 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 356 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 357 } 358 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 359 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 360 }; 361 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 362 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 363 }; 364 local_var_req_builder = local_var_req_builder.json(&commit_record_creation); 365 366 let local_var_req = local_var_req_builder.build()?; 367 let local_var_resp = local_var_client.execute(local_var_req).await?; 368 369 let local_var_status = local_var_resp.status(); 370 let local_var_content = local_var_resp.text().await?; 371 372 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 373 Ok(()) 374 } else { 375 let local_var_entity: Option<CreateCommitRecordError> = serde_json::from_str(&local_var_content).ok(); 376 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 377 Err(Error::ResponseError(local_var_error)) 378 } 379 } 380 381 pub async fn create_symlink_file(configuration: &configuration::Configuration, repository: &str, branch: &str, location: Option<&str>) -> Result<models::StorageUri, Error<CreateSymlinkFileError>> { 382 let local_var_configuration = configuration; 383 384 let local_var_client = &local_var_configuration.client; 385 386 let local_var_uri_str = format!("{}/repositories/{repository}/refs/{branch}/symlink", local_var_configuration.base_path, repository=crate::apis::urlencode(repository), branch=crate::apis::urlencode(branch)); 387 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 388 389 if let Some(ref local_var_str) = location { 390 local_var_req_builder = local_var_req_builder.query(&[("location", &local_var_str.to_string())]); 391 } 392 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 393 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 394 } 395 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 396 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 397 }; 398 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 399 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 400 }; 401 402 let local_var_req = local_var_req_builder.build()?; 403 let local_var_resp = local_var_client.execute(local_var_req).await?; 404 405 let local_var_status = local_var_resp.status(); 406 let local_var_content = local_var_resp.text().await?; 407 408 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 409 serde_json::from_str(&local_var_content).map_err(Error::from) 410 } else { 411 let local_var_entity: Option<CreateSymlinkFileError> = serde_json::from_str(&local_var_content).ok(); 412 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 413 Err(Error::ResponseError(local_var_error)) 414 } 415 } 416 417 /// Delete specified keys from the repository's metadata. 418 pub async fn delete_repository_metadata(configuration: &configuration::Configuration, repository: &str, repository_metadata_keys: models::RepositoryMetadataKeys) -> Result<(), Error<DeleteRepositoryMetadataError>> { 419 let local_var_configuration = configuration; 420 421 let local_var_client = &local_var_configuration.client; 422 423 let local_var_uri_str = format!("{}/repositories/{repository}/metadata", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 424 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); 425 426 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 427 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 428 } 429 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 430 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 431 }; 432 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 433 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 434 }; 435 local_var_req_builder = local_var_req_builder.json(&repository_metadata_keys); 436 437 let local_var_req = local_var_req_builder.build()?; 438 let local_var_resp = local_var_client.execute(local_var_req).await?; 439 440 let local_var_status = local_var_resp.status(); 441 let local_var_content = local_var_resp.text().await?; 442 443 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 444 Ok(()) 445 } else { 446 let local_var_entity: Option<DeleteRepositoryMetadataError> = serde_json::from_str(&local_var_content).ok(); 447 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 448 Err(Error::ResponseError(local_var_error)) 449 } 450 } 451 452 pub async fn dump_refs(configuration: &configuration::Configuration, repository: &str) -> Result<models::RefsDump, Error<DumpRefsError>> { 453 let local_var_configuration = configuration; 454 455 let local_var_client = &local_var_configuration.client; 456 457 let local_var_uri_str = format!("{}/repositories/{repository}/refs/dump", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 458 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); 459 460 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 461 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 462 } 463 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 464 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 465 }; 466 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 467 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 468 }; 469 470 let local_var_req = local_var_req_builder.build()?; 471 let local_var_resp = local_var_client.execute(local_var_req).await?; 472 473 let local_var_status = local_var_resp.status(); 474 let local_var_content = local_var_resp.text().await?; 475 476 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 477 serde_json::from_str(&local_var_content).map_err(Error::from) 478 } else { 479 let local_var_entity: Option<DumpRefsError> = serde_json::from_str(&local_var_content).ok(); 480 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 481 Err(Error::ResponseError(local_var_error)) 482 } 483 } 484 485 pub async fn get_auth_capabilities(configuration: &configuration::Configuration, ) -> Result<models::AuthCapabilities, Error<GetAuthCapabilitiesError>> { 486 let local_var_configuration = configuration; 487 488 let local_var_client = &local_var_configuration.client; 489 490 let local_var_uri_str = format!("{}/auth/capabilities", local_var_configuration.base_path); 491 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 492 493 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 494 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 495 } 496 497 let local_var_req = local_var_req_builder.build()?; 498 let local_var_resp = local_var_client.execute(local_var_req).await?; 499 500 let local_var_status = local_var_resp.status(); 501 let local_var_content = local_var_resp.text().await?; 502 503 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 504 serde_json::from_str(&local_var_content).map_err(Error::from) 505 } else { 506 let local_var_entity: Option<GetAuthCapabilitiesError> = serde_json::from_str(&local_var_content).ok(); 507 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 508 Err(Error::ResponseError(local_var_error)) 509 } 510 } 511 512 /// get information of gc settings 513 pub async fn get_garbage_collection_config(configuration: &configuration::Configuration, ) -> Result<models::GarbageCollectionConfig, Error<GetGarbageCollectionConfigError>> { 514 let local_var_configuration = configuration; 515 516 let local_var_client = &local_var_configuration.client; 517 518 let local_var_uri_str = format!("{}/config/garbage-collection", local_var_configuration.base_path); 519 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 520 521 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 522 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 523 } 524 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 525 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 526 }; 527 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 528 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 529 }; 530 531 let local_var_req = local_var_req_builder.build()?; 532 let local_var_resp = local_var_client.execute(local_var_req).await?; 533 534 let local_var_status = local_var_resp.status(); 535 let local_var_content = local_var_resp.text().await?; 536 537 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 538 serde_json::from_str(&local_var_content).map_err(Error::from) 539 } else { 540 let local_var_entity: Option<GetGarbageCollectionConfigError> = serde_json::from_str(&local_var_content).ok(); 541 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 542 Err(Error::ResponseError(local_var_error)) 543 } 544 } 545 546 /// get version of lakeFS server 547 pub async fn get_lake_fs_version(configuration: &configuration::Configuration, ) -> Result<models::VersionConfig, Error<GetLakeFsVersionError>> { 548 let local_var_configuration = configuration; 549 550 let local_var_client = &local_var_configuration.client; 551 552 let local_var_uri_str = format!("{}/config/version", local_var_configuration.base_path); 553 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 554 555 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 556 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 557 } 558 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 559 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 560 }; 561 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 562 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 563 }; 564 565 let local_var_req = local_var_req_builder.build()?; 566 let local_var_resp = local_var_client.execute(local_var_req).await?; 567 568 let local_var_status = local_var_resp.status(); 569 let local_var_content = local_var_resp.text().await?; 570 571 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 572 serde_json::from_str(&local_var_content).map_err(Error::from) 573 } else { 574 let local_var_entity: Option<GetLakeFsVersionError> = serde_json::from_str(&local_var_content).ok(); 575 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 576 Err(Error::ResponseError(local_var_error)) 577 } 578 } 579 580 pub async fn get_setup_state(configuration: &configuration::Configuration, ) -> Result<models::SetupState, Error<GetSetupStateError>> { 581 let local_var_configuration = configuration; 582 583 let local_var_client = &local_var_configuration.client; 584 585 let local_var_uri_str = format!("{}/setup_lakefs", local_var_configuration.base_path); 586 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 587 588 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 589 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 590 } 591 592 let local_var_req = local_var_req_builder.build()?; 593 let local_var_resp = local_var_client.execute(local_var_req).await?; 594 595 let local_var_status = local_var_resp.status(); 596 let local_var_content = local_var_resp.text().await?; 597 598 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 599 serde_json::from_str(&local_var_content).map_err(Error::from) 600 } else { 601 let local_var_entity: Option<GetSetupStateError> = serde_json::from_str(&local_var_content).ok(); 602 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 603 Err(Error::ResponseError(local_var_error)) 604 } 605 } 606 607 /// retrieve lakeFS storage configuration 608 pub async fn get_storage_config(configuration: &configuration::Configuration, ) -> Result<models::StorageConfig, Error<GetStorageConfigError>> { 609 let local_var_configuration = configuration; 610 611 let local_var_client = &local_var_configuration.client; 612 613 let local_var_uri_str = format!("{}/config/storage", local_var_configuration.base_path); 614 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 615 616 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 617 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 618 } 619 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 620 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 621 }; 622 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 623 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 624 }; 625 626 let local_var_req = local_var_req_builder.build()?; 627 let local_var_resp = local_var_client.execute(local_var_req).await?; 628 629 let local_var_status = local_var_resp.status(); 630 let local_var_content = local_var_resp.text().await?; 631 632 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 633 serde_json::from_str(&local_var_content).map_err(Error::from) 634 } else { 635 let local_var_entity: Option<GetStorageConfigError> = serde_json::from_str(&local_var_content).ok(); 636 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 637 Err(Error::ResponseError(local_var_error)) 638 } 639 } 640 641 pub async fn get_usage_report_summary(configuration: &configuration::Configuration, ) -> Result<models::InstallationUsageReport, Error<GetUsageReportSummaryError>> { 642 let local_var_configuration = configuration; 643 644 let local_var_client = &local_var_configuration.client; 645 646 let local_var_uri_str = format!("{}/usage-report/summary", local_var_configuration.base_path); 647 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 648 649 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 650 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 651 } 652 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 653 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 654 }; 655 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 656 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 657 }; 658 659 let local_var_req = local_var_req_builder.build()?; 660 let local_var_resp = local_var_client.execute(local_var_req).await?; 661 662 let local_var_status = local_var_resp.status(); 663 let local_var_content = local_var_resp.text().await?; 664 665 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 666 serde_json::from_str(&local_var_content).map_err(Error::from) 667 } else { 668 let local_var_entity: Option<GetUsageReportSummaryError> = serde_json::from_str(&local_var_content).ok(); 669 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 670 Err(Error::ResponseError(local_var_error)) 671 } 672 } 673 674 pub async fn internal_create_branch_protection_rule(configuration: &configuration::Configuration, repository: &str, branch_protection_rule: models::BranchProtectionRule) -> Result<(), Error<InternalCreateBranchProtectionRuleError>> { 675 let local_var_configuration = configuration; 676 677 let local_var_client = &local_var_configuration.client; 678 679 let local_var_uri_str = format!("{}/repositories/{repository}/branch_protection", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 680 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 681 682 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 683 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 684 } 685 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 686 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 687 }; 688 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 689 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 690 }; 691 local_var_req_builder = local_var_req_builder.json(&branch_protection_rule); 692 693 let local_var_req = local_var_req_builder.build()?; 694 let local_var_resp = local_var_client.execute(local_var_req).await?; 695 696 let local_var_status = local_var_resp.status(); 697 let local_var_content = local_var_resp.text().await?; 698 699 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 700 Ok(()) 701 } else { 702 let local_var_entity: Option<InternalCreateBranchProtectionRuleError> = serde_json::from_str(&local_var_content).ok(); 703 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 704 Err(Error::ResponseError(local_var_error)) 705 } 706 } 707 708 pub async fn internal_delete_branch_protection_rule(configuration: &configuration::Configuration, repository: &str, internal_delete_branch_protection_rule_request: models::InternalDeleteBranchProtectionRuleRequest) -> Result<(), Error<InternalDeleteBranchProtectionRuleError>> { 709 let local_var_configuration = configuration; 710 711 let local_var_client = &local_var_configuration.client; 712 713 let local_var_uri_str = format!("{}/repositories/{repository}/branch_protection", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 714 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); 715 716 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 717 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 718 } 719 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 720 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 721 }; 722 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 723 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 724 }; 725 local_var_req_builder = local_var_req_builder.json(&internal_delete_branch_protection_rule_request); 726 727 let local_var_req = local_var_req_builder.build()?; 728 let local_var_resp = local_var_client.execute(local_var_req).await?; 729 730 let local_var_status = local_var_resp.status(); 731 let local_var_content = local_var_resp.text().await?; 732 733 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 734 Ok(()) 735 } else { 736 let local_var_entity: Option<InternalDeleteBranchProtectionRuleError> = serde_json::from_str(&local_var_content).ok(); 737 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 738 Err(Error::ResponseError(local_var_error)) 739 } 740 } 741 742 pub async fn internal_delete_garbage_collection_rules(configuration: &configuration::Configuration, repository: &str) -> Result<(), Error<InternalDeleteGarbageCollectionRulesError>> { 743 let local_var_configuration = configuration; 744 745 let local_var_client = &local_var_configuration.client; 746 747 let local_var_uri_str = format!("{}/repositories/{repository}/gc/rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 748 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); 749 750 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 751 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 752 } 753 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 754 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 755 }; 756 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 757 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 758 }; 759 760 let local_var_req = local_var_req_builder.build()?; 761 let local_var_resp = local_var_client.execute(local_var_req).await?; 762 763 let local_var_status = local_var_resp.status(); 764 let local_var_content = local_var_resp.text().await?; 765 766 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 767 Ok(()) 768 } else { 769 let local_var_entity: Option<InternalDeleteGarbageCollectionRulesError> = serde_json::from_str(&local_var_content).ok(); 770 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 771 Err(Error::ResponseError(local_var_error)) 772 } 773 } 774 775 pub async fn internal_get_branch_protection_rules(configuration: &configuration::Configuration, repository: &str) -> Result<Vec<models::BranchProtectionRule>, Error<InternalGetBranchProtectionRulesError>> { 776 let local_var_configuration = configuration; 777 778 let local_var_client = &local_var_configuration.client; 779 780 let local_var_uri_str = format!("{}/repositories/{repository}/branch_protection", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 781 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 782 783 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 784 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 785 } 786 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 787 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 788 }; 789 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 790 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 791 }; 792 793 let local_var_req = local_var_req_builder.build()?; 794 let local_var_resp = local_var_client.execute(local_var_req).await?; 795 796 let local_var_status = local_var_resp.status(); 797 let local_var_content = local_var_resp.text().await?; 798 799 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 800 serde_json::from_str(&local_var_content).map_err(Error::from) 801 } else { 802 let local_var_entity: Option<InternalGetBranchProtectionRulesError> = serde_json::from_str(&local_var_content).ok(); 803 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 804 Err(Error::ResponseError(local_var_error)) 805 } 806 } 807 808 pub async fn internal_get_garbage_collection_rules(configuration: &configuration::Configuration, repository: &str) -> Result<models::GarbageCollectionRules, Error<InternalGetGarbageCollectionRulesError>> { 809 let local_var_configuration = configuration; 810 811 let local_var_client = &local_var_configuration.client; 812 813 let local_var_uri_str = format!("{}/repositories/{repository}/gc/rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 814 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 815 816 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 817 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 818 } 819 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 820 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 821 }; 822 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 823 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 824 }; 825 826 let local_var_req = local_var_req_builder.build()?; 827 let local_var_resp = local_var_client.execute(local_var_req).await?; 828 829 let local_var_status = local_var_resp.status(); 830 let local_var_content = local_var_resp.text().await?; 831 832 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 833 serde_json::from_str(&local_var_content).map_err(Error::from) 834 } else { 835 let local_var_entity: Option<InternalGetGarbageCollectionRulesError> = serde_json::from_str(&local_var_content).ok(); 836 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 837 Err(Error::ResponseError(local_var_error)) 838 } 839 } 840 841 pub async fn internal_set_garbage_collection_rules(configuration: &configuration::Configuration, repository: &str, garbage_collection_rules: models::GarbageCollectionRules) -> Result<(), Error<InternalSetGarbageCollectionRulesError>> { 842 let local_var_configuration = configuration; 843 844 let local_var_client = &local_var_configuration.client; 845 846 let local_var_uri_str = format!("{}/repositories/{repository}/gc/rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 847 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 848 849 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 850 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 851 } 852 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 853 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 854 }; 855 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 856 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 857 }; 858 local_var_req_builder = local_var_req_builder.json(&garbage_collection_rules); 859 860 let local_var_req = local_var_req_builder.build()?; 861 let local_var_resp = local_var_client.execute(local_var_req).await?; 862 863 let local_var_status = local_var_resp.status(); 864 let local_var_content = local_var_resp.text().await?; 865 866 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 867 Ok(()) 868 } else { 869 let local_var_entity: Option<InternalSetGarbageCollectionRulesError> = serde_json::from_str(&local_var_content).ok(); 870 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 871 Err(Error::ResponseError(local_var_error)) 872 } 873 } 874 875 pub async fn post_stats_events(configuration: &configuration::Configuration, stats_events_list: models::StatsEventsList) -> Result<(), Error<PostStatsEventsError>> { 876 let local_var_configuration = configuration; 877 878 let local_var_client = &local_var_configuration.client; 879 880 let local_var_uri_str = format!("{}/statistics", local_var_configuration.base_path); 881 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 882 883 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 884 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 885 } 886 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 887 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 888 }; 889 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 890 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 891 }; 892 local_var_req_builder = local_var_req_builder.json(&stats_events_list); 893 894 let local_var_req = local_var_req_builder.build()?; 895 let local_var_resp = local_var_client.execute(local_var_req).await?; 896 897 let local_var_status = local_var_resp.status(); 898 let local_var_content = local_var_resp.text().await?; 899 900 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 901 Ok(()) 902 } else { 903 let local_var_entity: Option<PostStatsEventsError> = serde_json::from_str(&local_var_content).ok(); 904 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 905 Err(Error::ResponseError(local_var_error)) 906 } 907 } 908 909 pub async fn prepare_garbage_collection_commits(configuration: &configuration::Configuration, repository: &str) -> Result<models::GarbageCollectionPrepareResponse, Error<PrepareGarbageCollectionCommitsError>> { 910 let local_var_configuration = configuration; 911 912 let local_var_client = &local_var_configuration.client; 913 914 let local_var_uri_str = format!("{}/repositories/{repository}/gc/prepare_commits", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 915 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 916 917 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 918 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 919 } 920 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 921 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 922 }; 923 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 924 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 925 }; 926 927 let local_var_req = local_var_req_builder.build()?; 928 let local_var_resp = local_var_client.execute(local_var_req).await?; 929 930 let local_var_status = local_var_resp.status(); 931 let local_var_content = local_var_resp.text().await?; 932 933 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 934 serde_json::from_str(&local_var_content).map_err(Error::from) 935 } else { 936 let local_var_entity: Option<PrepareGarbageCollectionCommitsError> = serde_json::from_str(&local_var_content).ok(); 937 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 938 Err(Error::ResponseError(local_var_error)) 939 } 940 } 941 942 pub async fn prepare_garbage_collection_uncommitted(configuration: &configuration::Configuration, repository: &str, prepare_gc_uncommitted_request: Option<models::PrepareGcUncommittedRequest>) -> Result<models::PrepareGcUncommittedResponse, Error<PrepareGarbageCollectionUncommittedError>> { 943 let local_var_configuration = configuration; 944 945 let local_var_client = &local_var_configuration.client; 946 947 let local_var_uri_str = format!("{}/repositories/{repository}/gc/prepare_uncommited", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 948 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 949 950 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 951 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 952 } 953 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 954 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 955 }; 956 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 957 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 958 }; 959 local_var_req_builder = local_var_req_builder.json(&prepare_gc_uncommitted_request); 960 961 let local_var_req = local_var_req_builder.build()?; 962 let local_var_resp = local_var_client.execute(local_var_req).await?; 963 964 let local_var_status = local_var_resp.status(); 965 let local_var_content = local_var_resp.text().await?; 966 967 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 968 serde_json::from_str(&local_var_content).map_err(Error::from) 969 } else { 970 let local_var_entity: Option<PrepareGarbageCollectionUncommittedError> = serde_json::from_str(&local_var_content).ok(); 971 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 972 Err(Error::ResponseError(local_var_error)) 973 } 974 } 975 976 pub async fn restore_refs(configuration: &configuration::Configuration, repository: &str, refs_restore: models::RefsRestore) -> Result<(), Error<RestoreRefsError>> { 977 let local_var_configuration = configuration; 978 979 let local_var_client = &local_var_configuration.client; 980 981 let local_var_uri_str = format!("{}/repositories/{repository}/refs/restore", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 982 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); 983 984 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 985 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 986 } 987 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 988 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 989 }; 990 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 991 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 992 }; 993 local_var_req_builder = local_var_req_builder.json(&refs_restore); 994 995 let local_var_req = local_var_req_builder.build()?; 996 let local_var_resp = local_var_client.execute(local_var_req).await?; 997 998 let local_var_status = local_var_resp.status(); 999 let local_var_content = local_var_resp.text().await?; 1000 1001 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1002 Ok(()) 1003 } else { 1004 let local_var_entity: Option<RestoreRefsError> = serde_json::from_str(&local_var_content).ok(); 1005 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1006 Err(Error::ResponseError(local_var_error)) 1007 } 1008 } 1009 1010 pub async fn set_garbage_collection_rules_preflight(configuration: &configuration::Configuration, repository: &str) -> Result<(), Error<SetGarbageCollectionRulesPreflightError>> { 1011 let local_var_configuration = configuration; 1012 1013 let local_var_client = &local_var_configuration.client; 1014 1015 let local_var_uri_str = format!("{}/repositories/{repository}/gc/rules/set_allowed", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 1016 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 1017 1018 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1019 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1020 } 1021 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 1022 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 1023 }; 1024 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 1025 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 1026 }; 1027 1028 let local_var_req = local_var_req_builder.build()?; 1029 let local_var_resp = local_var_client.execute(local_var_req).await?; 1030 1031 let local_var_status = local_var_resp.status(); 1032 let local_var_content = local_var_resp.text().await?; 1033 1034 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1035 Ok(()) 1036 } else { 1037 let local_var_entity: Option<SetGarbageCollectionRulesPreflightError> = serde_json::from_str(&local_var_content).ok(); 1038 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1039 Err(Error::ResponseError(local_var_error)) 1040 } 1041 } 1042 1043 /// Set repository metadata. This will only add or update the provided keys, and will not remove any existing keys. 1044 pub async fn set_repository_metadata(configuration: &configuration::Configuration, repository: &str, repository_metadata_set: models::RepositoryMetadataSet) -> Result<(), Error<SetRepositoryMetadataError>> { 1045 let local_var_configuration = configuration; 1046 1047 let local_var_client = &local_var_configuration.client; 1048 1049 let local_var_uri_str = format!("{}/repositories/{repository}/metadata", local_var_configuration.base_path, repository=crate::apis::urlencode(repository)); 1050 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 1051 1052 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1053 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1054 } 1055 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 1056 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 1057 }; 1058 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 1059 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 1060 }; 1061 local_var_req_builder = local_var_req_builder.json(&repository_metadata_set); 1062 1063 let local_var_req = local_var_req_builder.build()?; 1064 let local_var_resp = local_var_client.execute(local_var_req).await?; 1065 1066 let local_var_status = local_var_resp.status(); 1067 let local_var_content = local_var_resp.text().await?; 1068 1069 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1070 Ok(()) 1071 } else { 1072 let local_var_entity: Option<SetRepositoryMetadataError> = serde_json::from_str(&local_var_content).ok(); 1073 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1074 Err(Error::ResponseError(local_var_error)) 1075 } 1076 } 1077 1078 pub async fn setup(configuration: &configuration::Configuration, setup: models::Setup) -> Result<models::CredentialsWithSecret, Error<SetupError>> { 1079 let local_var_configuration = configuration; 1080 1081 let local_var_client = &local_var_configuration.client; 1082 1083 let local_var_uri_str = format!("{}/setup_lakefs", local_var_configuration.base_path); 1084 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 1085 1086 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1087 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1088 } 1089 local_var_req_builder = local_var_req_builder.json(&setup); 1090 1091 let local_var_req = local_var_req_builder.build()?; 1092 let local_var_resp = local_var_client.execute(local_var_req).await?; 1093 1094 let local_var_status = local_var_resp.status(); 1095 let local_var_content = local_var_resp.text().await?; 1096 1097 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1098 serde_json::from_str(&local_var_content).map_err(Error::from) 1099 } else { 1100 let local_var_entity: Option<SetupError> = serde_json::from_str(&local_var_content).ok(); 1101 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1102 Err(Error::ResponseError(local_var_error)) 1103 } 1104 } 1105 1106 pub async fn setup_comm_prefs(configuration: &configuration::Configuration, comm_prefs_input: models::CommPrefsInput) -> Result<(), Error<SetupCommPrefsError>> { 1107 let local_var_configuration = configuration; 1108 1109 let local_var_client = &local_var_configuration.client; 1110 1111 let local_var_uri_str = format!("{}/setup_comm_prefs", local_var_configuration.base_path); 1112 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 1113 1114 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1115 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1116 } 1117 local_var_req_builder = local_var_req_builder.json(&comm_prefs_input); 1118 1119 let local_var_req = local_var_req_builder.build()?; 1120 let local_var_resp = local_var_client.execute(local_var_req).await?; 1121 1122 let local_var_status = local_var_resp.status(); 1123 let local_var_content = local_var_resp.text().await?; 1124 1125 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1126 Ok(()) 1127 } else { 1128 let local_var_entity: Option<SetupCommPrefsError> = serde_json::from_str(&local_var_content).ok(); 1129 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1130 Err(Error::ResponseError(local_var_error)) 1131 } 1132 } 1133 1134 pub async fn stage_object(configuration: &configuration::Configuration, repository: &str, branch: &str, path: &str, object_stage_creation: models::ObjectStageCreation) -> Result<models::ObjectStats, Error<StageObjectError>> { 1135 let local_var_configuration = configuration; 1136 1137 let local_var_client = &local_var_configuration.client; 1138 1139 let local_var_uri_str = format!("{}/repositories/{repository}/branches/{branch}/objects", local_var_configuration.base_path, repository=crate::apis::urlencode(repository), branch=crate::apis::urlencode(branch)); 1140 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); 1141 1142 local_var_req_builder = local_var_req_builder.query(&[("path", &path.to_string())]); 1143 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1144 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1145 } 1146 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 1147 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 1148 }; 1149 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 1150 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 1151 }; 1152 local_var_req_builder = local_var_req_builder.json(&object_stage_creation); 1153 1154 let local_var_req = local_var_req_builder.build()?; 1155 let local_var_resp = local_var_client.execute(local_var_req).await?; 1156 1157 let local_var_status = local_var_resp.status(); 1158 let local_var_content = local_var_resp.text().await?; 1159 1160 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1161 serde_json::from_str(&local_var_content).map_err(Error::from) 1162 } else { 1163 let local_var_entity: Option<StageObjectError> = serde_json::from_str(&local_var_content).ok(); 1164 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1165 Err(Error::ResponseError(local_var_error)) 1166 } 1167 } 1168 1169 pub async fn upload_object_preflight(configuration: &configuration::Configuration, repository: &str, branch: &str, path: &str) -> Result<(), Error<UploadObjectPreflightError>> { 1170 let local_var_configuration = configuration; 1171 1172 let local_var_client = &local_var_configuration.client; 1173 1174 let local_var_uri_str = format!("{}/repositories/{repository}/branches/{branch}/objects/stage_allowed", local_var_configuration.base_path, repository=crate::apis::urlencode(repository), branch=crate::apis::urlencode(branch)); 1175 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); 1176 1177 local_var_req_builder = local_var_req_builder.query(&[("path", &path.to_string())]); 1178 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 1179 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); 1180 } 1181 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { 1182 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); 1183 }; 1184 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token { 1185 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); 1186 }; 1187 1188 let local_var_req = local_var_req_builder.build()?; 1189 let local_var_resp = local_var_client.execute(local_var_req).await?; 1190 1191 let local_var_status = local_var_resp.status(); 1192 let local_var_content = local_var_resp.text().await?; 1193 1194 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { 1195 Ok(()) 1196 } else { 1197 let local_var_entity: Option<UploadObjectPreflightError> = serde_json::from_str(&local_var_content).ok(); 1198 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 1199 Err(Error::ResponseError(local_var_error)) 1200 } 1201 } 1202