Skip to content

Commit 94b3787

Browse files
authored
feat(block): add support for import snapshot from object (#400)
1 parent 388285f commit 94b3787

File tree

6 files changed

+0
-190
lines changed

6 files changed

+0
-190
lines changed

scaleway-async/scaleway_async/block/v1alpha1/api.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
CreateVolumeRequest,
2929
UpdateVolumeRequest,
3030
CreateSnapshotRequest,
31-
ImportSnapshotFromS3Request,
3231
UpdateSnapshotRequest,
3332
)
3433
from .content import (
@@ -38,7 +37,6 @@
3837
from .marshalling import (
3938
marshal_CreateSnapshotRequest,
4039
marshal_CreateVolumeRequest,
41-
marshal_ImportSnapshotFromS3Request,
4240
marshal_UpdateSnapshotRequest,
4341
marshal_UpdateVolumeRequest,
4442
unmarshal_Volume,
@@ -641,51 +639,6 @@ async def create_snapshot(
641639
self._throw_on_error(res)
642640
return unmarshal_Snapshot(res.json())
643641

644-
async def import_snapshot_from_s3(
645-
self,
646-
*,
647-
bucket: str,
648-
key: str,
649-
name: str,
650-
zone: Optional[Zone] = None,
651-
project_id: Optional[str] = None,
652-
tags: Optional[List[str]] = None,
653-
size: Optional[int] = None,
654-
) -> Snapshot:
655-
"""
656-
657-
Usage:
658-
::
659-
660-
result = await api.import_snapshot_from_s3(
661-
bucket="example",
662-
key="example",
663-
name="example",
664-
)
665-
"""
666-
667-
param_zone = validate_path_param("zone", zone or self.client.default_zone)
668-
669-
res = self._request(
670-
"POST",
671-
f"/block/v1alpha1/zones/{param_zone}/snapshots/import-from-s3",
672-
body=marshal_ImportSnapshotFromS3Request(
673-
ImportSnapshotFromS3Request(
674-
bucket=bucket,
675-
key=key,
676-
name=name,
677-
zone=zone,
678-
project_id=project_id,
679-
tags=tags,
680-
size=size,
681-
),
682-
self.client,
683-
),
684-
)
685-
686-
self._throw_on_error(res)
687-
return unmarshal_Snapshot(res.json())
688-
689642
async def delete_snapshot(
690643
self,
691644
*,

scaleway-async/scaleway_async/block/v1alpha1/marshalling.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
CreateVolumeRequest,
2929
UpdateVolumeRequest,
3030
CreateSnapshotRequest,
31-
ImportSnapshotFromS3Request,
3231
UpdateSnapshotRequest,
3332
)
3433

@@ -430,33 +429,6 @@ def marshal_CreateVolumeRequest(
430429
return output
431430

432431

433-
def marshal_ImportSnapshotFromS3Request(
434-
request: ImportSnapshotFromS3Request,
435-
defaults: ProfileDefaults,
436-
) -> Dict[str, Any]:
437-
output: Dict[str, Any] = {}
438-
439-
if request.bucket is not None:
440-
output["bucket"] = request.bucket
441-
442-
if request.key is not None:
443-
output["key"] = request.key
444-
445-
if request.name is not None:
446-
output["name"] = request.name
447-
448-
if request.project_id is not None:
449-
output["project_id"] = request.project_id or defaults.default_project_id
450-
451-
if request.size is not None:
452-
output["size"] = request.size
453-
454-
if request.tags is not None:
455-
output["tags"] = request.tags
456-
457-
return output
458-
459-
460432
def marshal_UpdateSnapshotRequest(
461433
request: UpdateSnapshotRequest,
462434
defaults: ProfileDefaults,

scaleway-async/scaleway_async/block/v1alpha1/types.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -749,26 +749,6 @@ class CreateSnapshotRequest:
749749
"""
750750

751751

752-
@dataclass
753-
class ImportSnapshotFromS3Request:
754-
zone: Optional[Zone]
755-
"""
756-
Zone to target. If none is passed will use default zone from the config.
757-
"""
758-
759-
bucket: str
760-
761-
key: str
762-
763-
name: str
764-
765-
project_id: Optional[str]
766-
767-
tags: Optional[List[str]]
768-
769-
size: Optional[int]
770-
771-
772752
@dataclass
773753
class DeleteSnapshotRequest:
774754
zone: Optional[Zone]

scaleway/scaleway/block/v1alpha1/api.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
CreateVolumeRequest,
2929
UpdateVolumeRequest,
3030
CreateSnapshotRequest,
31-
ImportSnapshotFromS3Request,
3231
UpdateSnapshotRequest,
3332
)
3433
from .content import (
@@ -38,7 +37,6 @@
3837
from .marshalling import (
3938
marshal_CreateSnapshotRequest,
4039
marshal_CreateVolumeRequest,
41-
marshal_ImportSnapshotFromS3Request,
4240
marshal_UpdateSnapshotRequest,
4341
marshal_UpdateVolumeRequest,
4442
unmarshal_Volume,
@@ -639,51 +637,6 @@ def create_snapshot(
639637
self._throw_on_error(res)
640638
return unmarshal_Snapshot(res.json())
641639

642-
def import_snapshot_from_s3(
643-
self,
644-
*,
645-
bucket: str,
646-
key: str,
647-
name: str,
648-
zone: Optional[Zone] = None,
649-
project_id: Optional[str] = None,
650-
tags: Optional[List[str]] = None,
651-
size: Optional[int] = None,
652-
) -> Snapshot:
653-
"""
654-
655-
Usage:
656-
::
657-
658-
result = api.import_snapshot_from_s3(
659-
bucket="example",
660-
key="example",
661-
name="example",
662-
)
663-
"""
664-
665-
param_zone = validate_path_param("zone", zone or self.client.default_zone)
666-
667-
res = self._request(
668-
"POST",
669-
f"/block/v1alpha1/zones/{param_zone}/snapshots/import-from-s3",
670-
body=marshal_ImportSnapshotFromS3Request(
671-
ImportSnapshotFromS3Request(
672-
bucket=bucket,
673-
key=key,
674-
name=name,
675-
zone=zone,
676-
project_id=project_id,
677-
tags=tags,
678-
size=size,
679-
),
680-
self.client,
681-
),
682-
)
683-
684-
self._throw_on_error(res)
685-
return unmarshal_Snapshot(res.json())
686-
687640
def delete_snapshot(
688641
self,
689642
*,

scaleway/scaleway/block/v1alpha1/marshalling.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
CreateVolumeRequest,
2929
UpdateVolumeRequest,
3030
CreateSnapshotRequest,
31-
ImportSnapshotFromS3Request,
3231
UpdateSnapshotRequest,
3332
)
3433

@@ -430,33 +429,6 @@ def marshal_CreateVolumeRequest(
430429
return output
431430

432431

433-
def marshal_ImportSnapshotFromS3Request(
434-
request: ImportSnapshotFromS3Request,
435-
defaults: ProfileDefaults,
436-
) -> Dict[str, Any]:
437-
output: Dict[str, Any] = {}
438-
439-
if request.bucket is not None:
440-
output["bucket"] = request.bucket
441-
442-
if request.key is not None:
443-
output["key"] = request.key
444-
445-
if request.name is not None:
446-
output["name"] = request.name
447-
448-
if request.project_id is not None:
449-
output["project_id"] = request.project_id or defaults.default_project_id
450-
451-
if request.size is not None:
452-
output["size"] = request.size
453-
454-
if request.tags is not None:
455-
output["tags"] = request.tags
456-
457-
return output
458-
459-
460432
def marshal_UpdateSnapshotRequest(
461433
request: UpdateSnapshotRequest,
462434
defaults: ProfileDefaults,

scaleway/scaleway/block/v1alpha1/types.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -749,26 +749,6 @@ class CreateSnapshotRequest:
749749
"""
750750

751751

752-
@dataclass
753-
class ImportSnapshotFromS3Request:
754-
zone: Optional[Zone]
755-
"""
756-
Zone to target. If none is passed will use default zone from the config.
757-
"""
758-
759-
bucket: str
760-
761-
key: str
762-
763-
name: str
764-
765-
project_id: Optional[str]
766-
767-
tags: Optional[List[str]]
768-
769-
size: Optional[int]
770-
771-
772752
@dataclass
773753
class DeleteSnapshotRequest:
774754
zone: Optional[Zone]

0 commit comments

Comments
 (0)