Skip to content

Commit e420445

Browse files
authored
feat(block): add support for import snapshot from object (#1956)
1 parent 16aeba3 commit e420445

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

api/block/v1alpha1/block_sdk.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -559,24 +559,6 @@ type GetVolumeRequest struct {
559559
VolumeID string `json:"-"`
560560
}
561561

562-
// ImportSnapshotFromS3Request: import snapshot from s3 request.
563-
type ImportSnapshotFromS3Request struct {
564-
// Zone: zone to target. If none is passed will use default zone from the config.
565-
Zone scw.Zone `json:"-"`
566-
567-
Bucket string `json:"bucket"`
568-
569-
Key string `json:"key"`
570-
571-
Name string `json:"name"`
572-
573-
ProjectID string `json:"project_id"`
574-
575-
Tags []string `json:"tags"`
576-
577-
Size *scw.Size `json:"size,omitempty"`
578-
}
579-
580562
// ListSnapshotsRequest: list snapshots request.
581563
type ListSnapshotsRequest struct {
582564
// Zone: zone to target. If none is passed will use default zone from the config.
@@ -1147,43 +1129,6 @@ func (s *API) CreateSnapshot(req *CreateSnapshotRequest, opts ...scw.RequestOpti
11471129
return &resp, nil
11481130
}
11491131

1150-
// ImportSnapshotFromS3:
1151-
func (s *API) ImportSnapshotFromS3(req *ImportSnapshotFromS3Request, opts ...scw.RequestOption) (*Snapshot, error) {
1152-
var err error
1153-
1154-
if req.Zone == "" {
1155-
defaultZone, _ := s.client.GetDefaultZone()
1156-
req.Zone = defaultZone
1157-
}
1158-
1159-
if req.ProjectID == "" {
1160-
defaultProjectID, _ := s.client.GetDefaultProjectID()
1161-
req.ProjectID = defaultProjectID
1162-
}
1163-
1164-
if fmt.Sprint(req.Zone) == "" {
1165-
return nil, errors.New("field Zone cannot be empty in request")
1166-
}
1167-
1168-
scwReq := &scw.ScalewayRequest{
1169-
Method: "POST",
1170-
Path: "/block/v1alpha1/zones/" + fmt.Sprint(req.Zone) + "/snapshots/import-from-s3",
1171-
}
1172-
1173-
err = scwReq.SetBody(req)
1174-
if err != nil {
1175-
return nil, err
1176-
}
1177-
1178-
var resp Snapshot
1179-
1180-
err = s.client.Do(scwReq, &resp, opts...)
1181-
if err != nil {
1182-
return nil, err
1183-
}
1184-
return &resp, nil
1185-
}
1186-
11871132
// DeleteSnapshot: You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.
11881133
func (s *API) DeleteSnapshot(req *DeleteSnapshotRequest, opts ...scw.RequestOption) error {
11891134
var err error

0 commit comments

Comments
 (0)