Skip to content

Commit 210045c

Browse files
authored
feat(block): improve arguments configuration (scaleway#2309)
1 parent a5a30db commit 210045c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/block/v1alpha1/block_sdk.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,10 @@ func (s *API) CreateVolume(req *CreateVolumeRequest, opts ...scw.RequestOption)
10081008
req.ProjectID = defaultProjectID
10091009
}
10101010

1011+
if req.Name == "" {
1012+
req.Name = namegenerator.GetRandomName("vol")
1013+
}
1014+
10111015
if fmt.Sprint(req.Zone) == "" {
10121016
return nil, errors.New("field Zone cannot be empty in request")
10131017
}
@@ -1216,6 +1220,10 @@ func (s *API) CreateSnapshot(req *CreateSnapshotRequest, opts ...scw.RequestOpti
12161220
req.ProjectID = defaultProjectID
12171221
}
12181222

1223+
if req.Name == "" {
1224+
req.Name = namegenerator.GetRandomName("snp")
1225+
}
1226+
12191227
if fmt.Sprint(req.Zone) == "" {
12201228
return nil, errors.New("field Zone cannot be empty in request")
12211229
}

0 commit comments

Comments
 (0)