@@ -421,11 +421,8 @@ public DisassociateFloatingIp disassociateFloatingIp(String serverId, String flo
421421
422422 public class AttachVolume extends OpenStackRequest <Void > {
423423
424- public AttachVolume (String serverId , final String volumeId , final String device ) {
425- super (CLIENT , HttpMethod .POST , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments" ), Entity .json (new VolumeAttachment () {{
426- setVolumeId (volumeId );
427- setDevice (device );
428- }}), Void .class );
424+ public AttachVolume (String serverId , final VolumeAttachment volumeAttachment ) {
425+ super (CLIENT , HttpMethod .POST , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments" ), Entity .json (volumeAttachment ), Void .class );
429426 }
430427
431428 }
@@ -442,8 +439,11 @@ public DetachVolume(String serverId, String volumeId) {
442439
443440 }
444441
445- public AttachVolume attachVolume (String serverId , String volumeId , String device ) {
446- return new AttachVolume (serverId , volumeId , device );
442+ public AttachVolume attachVolume (String serverId , String volumeId , String device ) {
443+ VolumeAttachment volumeAttachment = new VolumeAttachment ();
444+ volumeAttachment .setVolumeId (volumeId );
445+ volumeAttachment .setDevice (device );
446+ return new AttachVolume (serverId , volumeAttachment );
447447 }
448448
449449 public DetachVolume detachVolume (String serverId , String volumeId ) {
0 commit comments