public static string CBS_m_ListAttachedVolumes(string dcregion) { IEnumerable <Volume> ListVolumes = BlockStorage.blockStorageProvider().ListVolumes(dcregion); var GetVolumeID = ListVolumes.ToList(); var GetVolumeID_SB = new StringBuilder(); foreach (var i in GetVolumeID) { var attachments_var = i.Attachments; foreach (var item in attachments_var) { GetVolumeID_SB.AppendLine(i.DisplayName + "<br />"); foreach (var item2 in item.Values) { GetVolumeID_SB.AppendLine(item2 + "<br />"); } GetVolumeID_SB.AppendLine("<br />"); } } return(GetVolumeID_SB.ToString()); }
protected void CBS_btn_CreateSnapShot_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); string CBSCreateSnapShotID = CBS_ddl_ListVolumes.SelectedValue; string description = CBS_txt_SnapShotDescription.Text; string displayname = CBS_Txt_SnapshotDisplayName.Text; try { BlockStorage.CBS_m_CreateSnapShot(CBSCreateSnapShotID, displayname, description, region); bindListSnapShotsDDL(BlockStorage.CBS_m_ListSnapShots(region), "DisplayName", "Id"); CBS_m_MsgCreateSnapShotSuccess(); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void CBS_btn_CreateVolume_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string CBSCreateVolumeName = HttpUtility.HtmlEncode(CBS_txt_CreateVolumeName.Text); string region = CBS_ddl_Region.SelectedItem.ToString(); int size = int.Parse(CBSCreateVolumeSizeDDL.SelectedValue); string description = CBS_txt_CreateVolumeDescription.Text; string displayname = CBS_txt_CreateVolumeDisplayname.Text; string volumetype = CBS_ddl_ListVolumeType.SelectedItem.ToString(); try { BlockStorage.CBS_m_CreateVolume(size, description, displayname, volumetype, region); CBS_m_MsgCreateVolumeSuccess(); bindListSnapShotsDDL(BlockStorage.CBS_m_ListSnapShots(region), "DisplayName", "Id"); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void CBS_ddl_ListVolumes_SelectChange(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); try { bindListNetworksSessionDDL(BlockStorage.CBS_m_ListVolumes(region), "DisplayName", "Id", CBSListVolumesSession()); CBS_lbl_Info.Text = CBS_m_GetVolumeinfo(BlockStorage.CBS_m_ListVolumes(region)); bindListSnapShotsDDL(BlockStorage.CBS_m_ListSnapShots(region), "DisplayName", "Id"); bindListVolumeTypeDDL(BlockStorage.CBS_m_ListVolumesType(region), "Name"); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void CBS_ddl_Region_SelectChange(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); try { StringBuilder listVolumesSB = new StringBuilder(); var listVolumes = BlockStorage.CBS_m_ListVolumes(region); bindListNetworksDDL(listVolumes, "DisplayName", "Id"); foreach (var volume in listVolumes) { listVolumesSB.Append(volume.Status); } CBS_lbl_VolumeStatus.Text = "Volume Status : " + listVolumesSB.ToString(); StringBuilder listSnapshotsSB = new StringBuilder(); var listSnapshots = BlockStorage.CBS_m_ListSnapShots(region); bindListSnapShotsDDL(listSnapshots, "DisplayName", "Id"); foreach (var snapshot in listSnapshots) { listSnapshotsSB.Append(snapshot.Status); } CBS_lbl_SnapshotStatus.Text = "Snapshot Status : " + listSnapshotsSB.ToString(); CBS_lbl_Info.Text = CBS_m_GetVolumeinfo(BlockStorage.CBS_m_ListVolumes(region)); bindListVolumeTypeDDL(BlockStorage.CBS_m_ListVolumesType(region), "Name"); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void CBS_btn_ListSnapShots_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); try { bindListSnapShotsDDL(BlockStorage.CBS_m_ListSnapShots(region), "DisplayName", "Id"); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void CBS_btn_DeleteVolume_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); string CBSDeleteVolumeID = CBS_ddl_ListVolumes.SelectedValue; try { BlockStorage.CBS_m_DeleteVolume(CBSDeleteVolumeID, region); BlockStorage.CBS_m_ListVolumes(region); BlockStorage.CBS_m_ListVolumesType(region); CBS_m_MsgDeleteVolumeSuccess(); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CBS_ddl_Region.SelectedItem.ToString(); HttpContext.Current.Session["CBSListVolumes"] = HttpUtility.HtmlEncode(CBS_ddl_ListVolumes.SelectedItem); HttpContext.Current.Session["CBSListSnapshots"] = CBS_ddl_ListSnapShots.Text; Page.GetPostBackEventReference(CBS_btn_CreateVolume); try { if (Page.IsPostBack) { } else { if (string.IsNullOrEmpty((string)(Session["CloudIdentityUserName"])) & string.IsNullOrEmpty((string)(Session["CloudIdentityApiKey"]))) { CBS_lbl_Error.Text = "Before continuing please login and enter Cloud Username and API Key."; } else if (string.IsNullOrEmpty((string)(Session["CloudIdentityUserName"]))) { CBS_lbl_Error.Text = "Before continuing please login and please enter Cloud Username."; } else if (string.IsNullOrEmpty((string)(Session["CloudIdentityApiKey"]))) { CBS_lbl_Error.Text = "Before continuing please login and please enter API Key."; } else { StringBuilder listVolumesSB = new StringBuilder(); var listVolumes = BlockStorage.CBS_m_ListVolumes(region); bindListNetworksDDL(listVolumes, "DisplayName", "Id"); foreach (var volume in listVolumes) { listVolumesSB.Append(volume.Status); } CBS_lbl_VolumeStatus.Text = "Volume Status : " + listVolumesSB.ToString(); StringBuilder listSnapshotsSB = new StringBuilder(); var listSnapshots = BlockStorage.CBS_m_ListSnapShots(region); bindListSnapShotsDDL(listSnapshots, "DisplayName", "Id"); foreach (var snapshot in listSnapshots) { listSnapshotsSB.Append(snapshot); } CBS_lbl_SnapshotStatus.Text = "Snapshot Status : " + listSnapshotsSB.ToString(); CBS_lbl_Info.Text = CBS_m_GetVolumeinfo(BlockStorage.CBS_m_ListVolumes(region)); bindListVolumeTypeDDL(BlockStorage.CBS_m_ListVolumesType(region), "Name"); TimeClock.Stop(); CBS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } } } catch (Exception ex) { CBS_m_MsgCatchException(ex.ToString()); } }