| 319 | |
| 320 | |
| 321 | Try<ActionObject> ActionObject::createDisk( |
| 322 | const Offer::Operation::CreateDisk& createDisk) |
| 323 | { |
| 324 | auto action = ([&createDisk]() -> Option<authorization::Action> { |
| 325 | switch (createDisk.target_type()) { |
| 326 | case Resource::DiskInfo::Source::MOUNT: |
| 327 | return authorization::CREATE_MOUNT_DISK; |
| 328 | case Resource::DiskInfo::Source::BLOCK: |
| 329 | return authorization::CREATE_BLOCK_DISK; |
| 330 | case Resource::DiskInfo::Source::UNKNOWN: |
| 331 | case Resource::DiskInfo::Source::PATH: |
| 332 | case Resource::DiskInfo::Source::RAW: |
| 333 | return None(); |
| 334 | } |
| 335 | |
| 336 | return None(); |
| 337 | })(); |
| 338 | |
| 339 | if (action.isNone()) { |
| 340 | return Error( |
| 341 | "Unsupported disk type: " + stringify(createDisk.target_type())); |
| 342 | } |
| 343 | |
| 344 | return fromResourceWithLegacyValue( |
| 345 | *action, createDisk.source(), getReservationRole(createDisk.source())); |
| 346 | } |
| 347 | |
| 348 | |
| 349 | Try<ActionObject> ActionObject::destroyDisk( |
nothing calls this directly
no test coverage detected