Coverage for abb_rws_client_python_rw6/rws/fileservice.py: 100%

31 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-13 22:17 +0000

1# This file is AUTO-GENERATED by utils/generator/main.py 

2# DO NOT EDIT MANUALLY — run the generator to regenerate. 

3# Generator author: Clement RACINET 

4""" 

5RWS module: File Service → Get File Service Resources 

6 

71:1 mirror of the ABB RobotWare 6 REST API. 

8Each function maps to exactly one HTTP endpoint. 

9No composed logic — see highlevel/ for wrappers. 

10""" 

11 

12from __future__ import annotations 

13 

14import httpx 

15 

16from abb_rws_client_python_rw6.core.client import RWSClient 

17 

18 

19async def get_file_service_resources(client: RWSClient) -> httpx.Response: 

20 """ 

21 Get File Service Resources. 

22 

23 Route: ``GET /fileservice`` 

24 ABB constraints: Though root supports environment variables these are not listed in the 

25 returned response. Environment variables are only allowed directly under the root URI 

26 i.e. /fileservice/$home Supported in bootserver mode 

27 

28 Args: 

29 client: Open RWSClient instance. 

30 

31 Returns: 

32 Raw HTTP response. Expected success: HTTP 200. 

33 

34 Raises: 

35 RWSAuthenticationError: On HTTP 401. 

36 RWSNotFoundError: On HTTP 404. 

37 RWSHTTPError: On any other HTTP >= 400. 

38 # ABB codes: UNAUTHORIZED(401),NOT_FOUND(404) 

39 

40 Example: 

41 ```python 

42 >>> await get_file_service_resources(client) 

43 <Response [200]> 

44 ``` 

45 """ 

46 return await client.get("/fileservice") 

47 

48 

49async def get_directory_listing_of_resources( 

50 client: RWSClient, 

51 environment_variable_device: str, 

52 directory: str, 

53) -> httpx.Response: 

54 """ 

55 Get Directory listing of resources. 

56 

57 Route: ``GET /fileservice/{environment_variable|device}/{directory}`` 

58 ABB constraints: Supported in bootserver mode 

59 

60 Args: 

61 client: Open RWSClient instance. 

62 environment_variable_device: URL path parameter. 

63 directory: URL path parameter. 

64 

65 Returns: 

66 Raw HTTP response. Expected success: HTTP 200. 

67 

68 Raises: 

69 RWSAuthenticationError: On HTTP 401. 

70 RWSNotFoundError: On HTTP 404. 

71 RWSHTTPError: On any other HTTP >= 400. 

72 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400) See 

73 

74 Example: 

75 ```python 

76 >>> await get_directory_listing_of_resources( 

77 ... client, 

78 ... "environment_variable_device_value", 

79 ... "directory_value" 

80 ... ) 

81 <Response [200]> 

82 ``` 

83 """ 

84 return await client.get(f"/fileservice/{environment_variable_device}/{directory}") 

85 

86 

87async def get_directory_actions( 

88 client: RWSClient, 

89 device: str, 

90 directory: str, 

91 action: str | None = None, 

92) -> httpx.Response: 

93 """ 

94 Get Directory Actions. 

95 

96 Route: ``GET /fileservice/{device}|{directory}`` 

97 ABB constraints: Supported in bootserver mode 

98 

99 Args: 

100 client: Open RWSClient instance. 

101 device: URL path parameter. 

102 directory: URL path parameter. 

103 action: Query parameter. Optional. 

104 

105 Returns: 

106 Raw HTTP response. Expected success: HTTP 200. 

107 

108 Raises: 

109 RWSAuthenticationError: On HTTP 401. 

110 RWSNotFoundError: On HTTP 404. 

111 RWSHTTPError: On any other HTTP >= 400. 

112 # ABB codes: BAD_REQUEST(400) See 

113 

114 Example: 

115 ```python 

116 >>> await get_directory_actions(client, "device_value", "directory_value") 

117 <Response [200]> 

118 ``` 

119 """ 

120 return await client.get( 

121 f"/fileservice/{device}|{directory}", 

122 params={k: v for k, v in {"action": action}.items() if v is not None}, 

123 ) 

124 

125 

126async def create_directory( 

127 client: RWSClient, 

128 device_environment_variable: str, 

129 directory: str, 

130) -> httpx.Response: 

131 """ 

132 Create a directory. 

133 

134 Route: ``POST /fileservice/{device|environment_variable}/{directory}`` 

135 ABB constraints: Only relative path are allowed for "*fs-newname*". Absolute paths are not 

136 supported The fs-newname can take nested directory structure e.g. 

137 fs-newname=parentdir/subdir will create both the directories if they don't exist i.e. 

138 subdir under parentdir Supported in bootserver mode 

139 

140 Args: 

141 client: Open RWSClient instance. 

142 device_environment_variable: URL path parameter. 

143 directory: URL path parameter. 

144 

145 Returns: 

146 Raw HTTP response. Expected success: HTTP 201. 

147 

148 Raises: 

149 RWSAuthenticationError: On HTTP 401. 

150 RWSNotFoundError: On HTTP 404. 

151 RWSHTTPError: On any other HTTP >= 400. 

152 # ABB codes: UNAUTHORIZED(401), BAD_REQUEST(400), UNSUPPORTED_MEDIA(415), 

153 

154 Example: 

155 ```python 

156 >>> await create_directory( 

157 ... client, 

158 ... "device_environment_variable_value", 

159 ... "directory_value" 

160 ... ) 

161 <Response [201]> 

162 ``` 

163 """ 

164 return await client.post( 

165 f"/fileservice/{device_environment_variable}/{directory}", 

166 data={}, 

167 ) 

168 

169 

170async def post_rename_directory( 

171 client: RWSClient, 

172 device_environment_variable: str, 

173 directory: str, 

174) -> httpx.Response: 

175 """ 

176 Rename a directory. 

177 

178 Route: ``POST /fileservice/{device|environment_variable}/{directory}`` 

179 ABB constraints: Supported in bootserver mode 

180 

181 Args: 

182 client: Open RWSClient instance. 

183 device_environment_variable: URL path parameter. 

184 directory: URL path parameter. 

185 

186 Returns: 

187 Raw HTTP response. Expected success: HTTP 200. 

188 

189 Raises: 

190 RWSAuthenticationError: On HTTP 401. 

191 RWSNotFoundError: On HTTP 404. 

192 RWSHTTPError: On any other HTTP >= 400. 

193 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400), UNSUPPORTED_MEDIA(415), 

194 METHOD_NOT_ALLOWED(405) 

195 

196 Example: 

197 ```python 

198 >>> await post_rename_directory( 

199 ... client, 

200 ... "device_environment_variable_value", 

201 ... "directory_value" 

202 ... ) 

203 <Response [200]> 

204 ``` 

205 """ 

206 return await client.post( 

207 f"/fileservice/{device_environment_variable}/{directory}", 

208 data={}, 

209 ) 

210 

211 

212async def post_copy_directory( 

213 client: RWSClient, 

214 device_environment_variable: str, 

215 directory: str, 

216) -> httpx.Response: 

217 """ 

218 Copy a directory. 

219 

220 Route: ``POST /fileservice/{device|environment_variable}/{directory}`` 

221 ABB constraints: The value for fs-newname can either be absolute or relative. It is 

222 differentiated based on whether the value has a leading slash (absolute) or not 

223 (relative). Note: when absolute paths are used, it should start from /fileservice e.g. 

224 Absolute path : fs-newname=/fileservice/$home/copydir2 Relative... 

225 

226 Args: 

227 client: Open RWSClient instance. 

228 device_environment_variable: URL path parameter. 

229 directory: URL path parameter. 

230 

231 Returns: 

232 Raw HTTP response. Expected success: HTTP 204. 

233 

234 Raises: 

235 RWSAuthenticationError: On HTTP 401. 

236 RWSNotFoundError: On HTTP 404. 

237 RWSHTTPError: On any other HTTP >= 400. 

238 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400), UNSUPPORTED_MEDIA(415), 

239 CONFLICT(409) 

240 

241 Example: 

242 ```python 

243 >>> await post_copy_directory( 

244 ... client, 

245 ... "device_environment_variable_value", 

246 ... "directory_value" 

247 ... ) 

248 <Response [204]> 

249 ``` 

250 """ 

251 return await client.post( 

252 f"/fileservice/{device_environment_variable}/{directory}", 

253 data={}, 

254 ) 

255 

256 

257async def delete_directory( 

258 client: RWSClient, 

259 device_environment_variable: str, 

260 directory: str, 

261) -> httpx.Response: 

262 """ 

263 Delete a directory. 

264 

265 Route: ``DELETE /fileservice/{device|environment_variable}/{directory}`` 

266 ABB constraints: Supported in bootserver mode 

267 

268 Args: 

269 client: Open RWSClient instance. 

270 device_environment_variable: URL path parameter. 

271 directory: URL path parameter. 

272 

273 Returns: 

274 Raw HTTP response. Expected success: HTTP 204. 

275 

276 Raises: 

277 RWSAuthenticationError: On HTTP 401. 

278 RWSNotFoundError: On HTTP 404. 

279 RWSHTTPError: On any other HTTP >= 400. 

280 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400), METHOD_NOT_ALLOWED(405) 

281 

282 Example: 

283 ```python 

284 >>> await delete_directory( 

285 ... client, 

286 ... "device_environment_variable_value", 

287 ... "directory_value" 

288 ... ) 

289 <Response [204]> 

290 ``` 

291 """ 

292 return await client.delete(f"/fileservice/{device_environment_variable}/{directory}") 

293 

294 

295async def get_file( 

296 client: RWSClient, 

297 device: str, 

298 directory: str, 

299 file: str, 

300) -> httpx.Response: 

301 """ 

302 Get a file. 

303 

304 Route: ``GET /fileservice/{device}|{directory}/{file}`` 

305 ABB constraints: Supported in bootserver mode 

306 

307 Args: 

308 client: Open RWSClient instance. 

309 device: URL path parameter. 

310 directory: URL path parameter. 

311 file: URL path parameter. 

312 

313 Returns: 

314 Raw HTTP response. Expected success: HTTP 200. 

315 

316 Raises: 

317 RWSAuthenticationError: On HTTP 401. 

318 RWSNotFoundError: On HTTP 404. 

319 RWSHTTPError: On any other HTTP >= 400. 

320 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), 

321 

322 Example: 

323 ```python 

324 >>> await get_file(client, "device_value", "directory_value", "file_value") 

325 <Response [200]> 

326 ``` 

327 """ 

328 return await client.get(f"/fileservice/{device}|{directory}/{file}") 

329 

330 

331async def get_file_actions( 

332 client: RWSClient, 

333 device: str, 

334 directory: str, 

335 file: str, 

336 action: str | None = None, 

337) -> httpx.Response: 

338 """ 

339 Get File Actions. 

340 

341 Route: ``GET /fileservice/{device}|{directory}/{file}`` 

342 ABB constraints: Supported in bootserver mode 

343 

344 Args: 

345 client: Open RWSClient instance. 

346 device: URL path parameter. 

347 directory: URL path parameter. 

348 file: URL path parameter. 

349 action: Query parameter. Optional. 

350 

351 Returns: 

352 Raw HTTP response. Expected success: HTTP 200. 

353 

354 Raises: 

355 RWSAuthenticationError: On HTTP 401. 

356 RWSNotFoundError: On HTTP 404. 

357 RWSHTTPError: On any other HTTP >= 400. 

358 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), See 

359 

360 Example: 

361 ```python 

362 >>> await get_file_actions(client, "device_value", "directory_value", "file_value") 

363 <Response [200]> 

364 ``` 

365 """ 

366 return await client.get( 

367 f"/fileservice/{device}|{directory}/{file}", 

368 params={k: v for k, v in {"action": action}.items() if v is not None}, 

369 ) 

370 

371 

372async def post_rename_file( 

373 client: RWSClient, 

374 device_environment_variable_directory: str, 

375 file: str, 

376) -> httpx.Response: 

377 """ 

378 Rename a file. 

379 

380 Route: ``POST /fileservice/{device|environment_variable|directory}/{file}`` 

381 ABB constraints: Supported in bootserver mode 

382 

383 Args: 

384 client: Open RWSClient instance. 

385 device_environment_variable_directory: URL path parameter. 

386 file: URL path parameter. 

387 

388 Returns: 

389 Raw HTTP response. Expected success: HTTP 204. 

390 

391 Raises: 

392 RWSAuthenticationError: On HTTP 401. 

393 RWSNotFoundError: On HTTP 404. 

394 RWSHTTPError: On any other HTTP >= 400. 

395 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400), UNSUPPORTED_MEDIA(415) 

396 

397 Example: 

398 ```python 

399 >>> await post_rename_file( 

400 ... client, 

401 ... "device_environment_variable_directory_value", 

402 ... "file_value" 

403 ... ) 

404 <Response [204]> 

405 ``` 

406 """ 

407 return await client.post( 

408 f"/fileservice/{device_environment_variable_directory}/{file}", 

409 data={}, 

410 ) 

411 

412 

413async def create_copy_of_file( 

414 client: RWSClient, 

415 device_environment_variable: str, 

416 filename: str, 

417) -> httpx.Response: 

418 """ 

419 Create a copy of a file. 

420 

421 Route: ``POST /fileservice/{device|environment_variable}/{filename}`` 

422 ABB constraints: The value for fs-newname can either be absolute or relative. It is 

423 differentiated based on the whether the value has a leading slash (absolute) or not 

424 (relative). Note: when absolute paths are used, it should start from /fileservice e.g. 

425 Absolute path : fs-newname=/fileservice/$home/copyfile2.txt... 

426 

427 Args: 

428 client: Open RWSClient instance. 

429 device_environment_variable: URL path parameter. 

430 filename: URL path parameter. 

431 

432 Returns: 

433 Raw HTTP response. Expected success: HTTP 204. 

434 

435 Raises: 

436 RWSAuthenticationError: On HTTP 401. 

437 RWSNotFoundError: On HTTP 404. 

438 RWSHTTPError: On any other HTTP >= 400. 

439 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400), UNSUPPORTED_MEDIA(415), 

440 CONFLICT(409) 

441 

442 Example: 

443 ```python 

444 >>> await create_copy_of_file( 

445 ... client, 

446 ... "device_environment_variable_value", 

447 ... "filename_value" 

448 ... ) 

449 <Response [204]> 

450 ``` 

451 """ 

452 return await client.post( 

453 f"/fileservice/{device_environment_variable}/{filename}", 

454 data={}, 

455 ) 

456 

457 

458async def put_upload_file( 

459 client: RWSClient, 

460 device_environment_variable_directory: str, 

461 file: str, 

462) -> httpx.Response: 

463 """ 

464 Upload a file. 

465 

466 Route: ``PUT /fileservice/{device|environment_variable|directory}/{file}`` 

467 ABB constraints: If the file exists, the file is overwritten with the specified content else 

468 a new file with the given name is created. Supported in bootserver mode Maximum supported 

469 file size is less than 800MB. 

470 

471 Args: 

472 client: Open RWSClient instance. 

473 device_environment_variable_directory: URL path parameter. 

474 file: URL path parameter. 

475 

476 Returns: 

477 Raw HTTP response. Expected success: HTTP 200. 

478 

479 Raises: 

480 RWSAuthenticationError: On HTTP 401. 

481 RWSNotFoundError: On HTTP 404. 

482 RWSHTTPError: On any other HTTP >= 400. 

483 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), FORBIDDEN(403), BAD_REQUEST(400) 

484 

485 Example: 

486 ```python 

487 >>> await put_upload_file( 

488 ... client, 

489 ... "device_environment_variable_directory_value", 

490 ... "file_value" 

491 ... ) 

492 <Response [200]> 

493 ``` 

494 """ 

495 return await client.put( 

496 f"/fileservice/{device_environment_variable_directory}/{file}", 

497 data={}, 

498 ) 

499 

500 

501async def delete_file( 

502 client: RWSClient, 

503 device_environment_variable_directory: str, 

504 file: str, 

505) -> httpx.Response: 

506 """ 

507 Delete a file. 

508 

509 Route: ``DELETE /fileservice/{device|environment_variable|directory}/{file}`` 

510 ABB constraints: Supported in bootserver mode 

511 

512 Args: 

513 client: Open RWSClient instance. 

514 device_environment_variable_directory: URL path parameter. 

515 file: URL path parameter. 

516 

517 Returns: 

518 Raw HTTP response. Expected success: HTTP 204. 

519 

520 Raises: 

521 RWSAuthenticationError: On HTTP 401. 

522 RWSNotFoundError: On HTTP 404. 

523 RWSHTTPError: On any other HTTP >= 400. 

524 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), BAD_REQUEST(400),METHOD_NOT_ALLOWED(405) 

525 

526 Example: 

527 ```python 

528 >>> await delete_file( 

529 ... client, 

530 ... "device_environment_variable_directory_value", 

531 ... "file_value" 

532 ... ) 

533 <Response [204]> 

534 ``` 

535 """ 

536 return await client.delete(f"/fileservice/{device_environment_variable_directory}/{file}") 

537 

538 

539async def get_file_meta_data( 

540 client: RWSClient, 

541 device_environment_variable_directory: str, 

542 file: str, 

543) -> httpx.Response: 

544 """ 

545 Get file Meta data. 

546 

547 Route: ``HEAD /fileservice/{device|environment_variable|directory}/{file}`` 

548 ABB constraints: Supported in bootserver mode 

549 

550 Args: 

551 client: Open RWSClient instance. 

552 device_environment_variable_directory: URL path parameter. 

553 file: URL path parameter. 

554 

555 Returns: 

556 Raw HTTP response. Expected success: HTTP 204. 

557 

558 Raises: 

559 RWSAuthenticationError: On HTTP 401. 

560 RWSNotFoundError: On HTTP 404. 

561 RWSHTTPError: On any other HTTP >= 400. 

562 # ABB codes: UNAUTHORIZED(401), NOT_FOUND(404), See 

563 

564 Example: 

565 ```python 

566 >>> await get_file_meta_data( 

567 ... client, 

568 ... "device_environment_variable_directory_value", 

569 ... "file_value" 

570 ... ) 

571 <Response [204]> 

572 ``` 

573 """ 

574 return await client.head(f"/fileservice/{device_environment_variable_directory}/{file}")