3333import com .woorea .openstack .nova .model .ServerForCreate ;
3434import com .woorea .openstack .nova .model .Servers ;
3535import com .woorea .openstack .nova .model .VolumeAttachment ;
36+ import com .woorea .openstack .nova .model .VolumeAttachments ;
3637
3738public class ServersResource {
3839
@@ -429,12 +430,24 @@ public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) {
429430
430431 public class DetachVolume extends OpenStackRequest <Void > {
431432
432- private String serverId ;
433+ public DetachVolume (String serverId , String volumeId ) {
434+ super (CLIENT , HttpMethod .DELETE , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments/" ).append (volumeId ), null , Void .class );
435+ }
436+
437+ }
438+
439+ public class ListVolumeAttachments extends OpenStackRequest <VolumeAttachments > {
433440
434- private String volumeId ;
441+ public ListVolumeAttachments (String serverId ) {
442+ super (CLIENT , HttpMethod .GET , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments" ), null , VolumeAttachments .class );
443+ }
444+
445+ }
446+
447+ public class ShowVolumeAttachment extends OpenStackRequest <VolumeAttachment > {
435448
436- public DetachVolume (String serverId , String volumeId ) {
437- super (CLIENT , HttpMethod .DELETE , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments" ).append (volumeId ), null , Void .class );
449+ public ShowVolumeAttachment (String serverId , String volumeAttachmentId ) {
450+ super (CLIENT , HttpMethod .GET , new StringBuilder ("/servers/" ).append (serverId ).append ("/os-volume_attachments/ " ).append (volumeAttachmentId ), null , VolumeAttachment .class );
438451 }
439452
440453 }
@@ -450,5 +463,13 @@ public DetachVolume detachVolume(String serverId, String volumeId) {
450463 return new DetachVolume (serverId , volumeId );
451464 }
452465
466+ public ListVolumeAttachments listVolumeAttachments (String serverId ) {
467+ return new ListVolumeAttachments (serverId );
468+ }
469+
470+ public ShowVolumeAttachment showVolumeAttachment (String serverId , String volumeAttachmentId ) {
471+ return new ShowVolumeAttachment (serverId , volumeAttachmentId );
472+ }
473+
453474}
454475
0 commit comments