Skip to content

Commit

Permalink
Taking the clone and cirtual disk changes
Browse files Browse the repository at this point in the history
  • Loading branch information
parvezah committed Apr 1, 2015
1 parent 3ac1024 commit ad0d5f4
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 64 deletions.
129 changes: 68 additions & 61 deletions src/StorSimple/Generated/CloneVolumeOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ public async Task<JobResponse> TriggerAsync(string sourceDeviceId, TriggerCloneR
{
throw new ArgumentNullException("triggerCloneRequest.SourceSnapshot.VolumeId");
}
if (triggerCloneRequest.TargetACRIdList == null)
{
throw new ArgumentNullException("triggerCloneRequest.TargetACRIdList");
}
if (triggerCloneRequest.TargetACRList == null)
{
throw new ArgumentNullException("triggerCloneRequest.TargetACRList");
}
if (triggerCloneRequest.TargetACRList != null)
{
foreach (AccessControlRecord targetACRListParameterItem in triggerCloneRequest.TargetACRList)
Expand All @@ -144,6 +136,10 @@ public async Task<JobResponse> TriggerAsync(string sourceDeviceId, TriggerCloneR
{
throw new ArgumentNullException("triggerCloneRequest.TargetDeviceId");
}
if (triggerCloneRequest.TargetVolName == null)
{
throw new ArgumentNullException("triggerCloneRequest.TargetVolName");
}
if (customRequestHeaders == null)
{
throw new ArgumentNullException("customRequestHeaders");
Expand Down Expand Up @@ -255,71 +251,82 @@ public async Task<JobResponse> TriggerAsync(string sourceDeviceId, TriggerCloneR
volumeIdElement.Value = triggerCloneRequest.SourceSnapshot.VolumeId;
sourceSnapshotElement.Add(volumeIdElement);

XElement targetACRIdListSequenceElement = new XElement(XName.Get("TargetACRIdList", "http://windowscloudbackup.com/CiS/V2013_03"));
foreach (string targetACRIdListItem in triggerCloneRequest.TargetACRIdList)
if (triggerCloneRequest.TargetACRIdList != null)
{
XElement targetACRIdListItemElement = new XElement(XName.Get("string", "http://schemas.microsoft.com/2003/10/Serialization/Arrays"));
targetACRIdListItemElement.Value = targetACRIdListItem;
targetACRIdListSequenceElement.Add(targetACRIdListItemElement);
XElement targetACRIdListSequenceElement = new XElement(XName.Get("TargetACRIdList", "http://windowscloudbackup.com/CiS/V2013_03"));
foreach (string targetACRIdListItem in triggerCloneRequest.TargetACRIdList)
{
XElement targetACRIdListItemElement = new XElement(XName.Get("string", "http://schemas.microsoft.com/2003/10/Serialization/Arrays"));
targetACRIdListItemElement.Value = targetACRIdListItem;
targetACRIdListSequenceElement.Add(targetACRIdListItemElement);
}
cloneRequestV2Element.Add(targetACRIdListSequenceElement);
}
else
{
XElement emptyElement = new XElement(XName.Get("TargetACRIdList", "http://windowscloudbackup.com/CiS/V2013_03"));
XAttribute nilAttribute = new XAttribute(XName.Get("nil", "http://www.w3.org/2001/XMLSchema-instance"), "");
nilAttribute.Value = "true";
emptyElement.Add(nilAttribute);
cloneRequestV2Element.Add(emptyElement);
}
cloneRequestV2Element.Add(targetACRIdListSequenceElement);

XElement targetACRListSequenceElement = new XElement(XName.Get("TargetACRList", "http://windowscloudbackup.com/CiS/V2013_03"));
foreach (AccessControlRecord targetACRListItem in triggerCloneRequest.TargetACRList)
if (triggerCloneRequest.TargetACRList != null)
{
XElement accessControlRecordElement = new XElement(XName.Get("AccessControlRecord", "http://windowscloudbackup.com/CiS/V2013_03"));
targetACRListSequenceElement.Add(accessControlRecordElement);

if (targetACRListItem.InstanceId != null)
{
XElement instanceIdElement = new XElement(XName.Get("InstanceId", "http://windowscloudbackup.com/CiS/V2013_03"));
instanceIdElement.Value = targetACRListItem.InstanceId;
accessControlRecordElement.Add(instanceIdElement);
}

XElement nameElement2 = new XElement(XName.Get("Name", "http://windowscloudbackup.com/CiS/V2013_03"));
nameElement2.Value = targetACRListItem.Name;
accessControlRecordElement.Add(nameElement2);

if (targetACRListItem.GlobalId != null)
{
XElement globalIdElement = new XElement(XName.Get("GlobalId", "http://schemas.datacontract.org/2004/07/Microsoft.Internal.CiS.Service.Interface.Portal"));
globalIdElement.Value = targetACRListItem.GlobalId;
accessControlRecordElement.Add(globalIdElement);
}
else
XElement targetACRListSequenceElement = new XElement(XName.Get("TargetACRList", "http://windowscloudbackup.com/CiS/V2013_03"));
foreach (AccessControlRecord targetACRListItem in triggerCloneRequest.TargetACRList)
{
XElement emptyElement = new XElement(XName.Get("GlobalId", "http://schemas.datacontract.org/2004/07/Microsoft.Internal.CiS.Service.Interface.Portal"));
XAttribute nilAttribute = new XAttribute(XName.Get("nil", "http://www.w3.org/2001/XMLSchema-instance"), "");
nilAttribute.Value = "true";
emptyElement.Add(nilAttribute);
accessControlRecordElement.Add(emptyElement);
XElement accessControlRecordElement = new XElement(XName.Get("AccessControlRecord", "http://windowscloudbackup.com/CiS/V2013_03"));
targetACRListSequenceElement.Add(accessControlRecordElement);

if (targetACRListItem.InstanceId != null)
{
XElement instanceIdElement = new XElement(XName.Get("InstanceId", "http://windowscloudbackup.com/CiS/V2013_03"));
instanceIdElement.Value = targetACRListItem.InstanceId;
accessControlRecordElement.Add(instanceIdElement);
}

XElement nameElement2 = new XElement(XName.Get("Name", "http://windowscloudbackup.com/CiS/V2013_03"));
nameElement2.Value = targetACRListItem.Name;
accessControlRecordElement.Add(nameElement2);

if (targetACRListItem.GlobalId != null)
{
XElement globalIdElement = new XElement(XName.Get("GlobalId", "http://schemas.datacontract.org/2004/07/Microsoft.Internal.CiS.Service.Interface.Portal"));
globalIdElement.Value = targetACRListItem.GlobalId;
accessControlRecordElement.Add(globalIdElement);
}
else
{
XElement emptyElement2 = new XElement(XName.Get("GlobalId", "http://schemas.datacontract.org/2004/07/Microsoft.Internal.CiS.Service.Interface.Portal"));
XAttribute nilAttribute2 = new XAttribute(XName.Get("nil", "http://www.w3.org/2001/XMLSchema-instance"), "");
nilAttribute2.Value = "true";
emptyElement2.Add(nilAttribute2);
accessControlRecordElement.Add(emptyElement2);
}

XElement operationInProgressElement = new XElement(XName.Get("OperationInProgress", "http://windowscloudbackup.com/CiS/V2013_03"));
operationInProgressElement.Value = targetACRListItem.OperationInProgress.ToString();
accessControlRecordElement.Add(operationInProgressElement);

XElement initiatorNameElement = new XElement(XName.Get("InitiatorName", "http://windowscloudbackup.com/CiS/V2013_03"));
initiatorNameElement.Value = targetACRListItem.InitiatorName;
accessControlRecordElement.Add(initiatorNameElement);

XElement volumeCountElement = new XElement(XName.Get("VolumeCount", "http://windowscloudbackup.com/CiS/V2013_03"));
volumeCountElement.Value = targetACRListItem.VolumeCount.ToString();
accessControlRecordElement.Add(volumeCountElement);
}

XElement operationInProgressElement = new XElement(XName.Get("OperationInProgress", "http://windowscloudbackup.com/CiS/V2013_03"));
operationInProgressElement.Value = targetACRListItem.OperationInProgress.ToString();
accessControlRecordElement.Add(operationInProgressElement);

XElement initiatorNameElement = new XElement(XName.Get("InitiatorName", "http://windowscloudbackup.com/CiS/V2013_03"));
initiatorNameElement.Value = targetACRListItem.InitiatorName;
accessControlRecordElement.Add(initiatorNameElement);

XElement volumeCountElement = new XElement(XName.Get("VolumeCount", "http://windowscloudbackup.com/CiS/V2013_03"));
volumeCountElement.Value = targetACRListItem.VolumeCount.ToString();
accessControlRecordElement.Add(volumeCountElement);
cloneRequestV2Element.Add(targetACRListSequenceElement);
}
cloneRequestV2Element.Add(targetACRListSequenceElement);

XElement targetDeviceIdElement = new XElement(XName.Get("TargetDeviceId", "http://windowscloudbackup.com/CiS/V2013_03"));
targetDeviceIdElement.Value = triggerCloneRequest.TargetDeviceId;
cloneRequestV2Element.Add(targetDeviceIdElement);

if (triggerCloneRequest.TargetVolName != null)
{
XElement targetVolNameElement = new XElement(XName.Get("TargetVolName", "http://windowscloudbackup.com/CiS/V2013_03"));
targetVolNameElement.Value = triggerCloneRequest.TargetVolName;
cloneRequestV2Element.Add(targetVolNameElement);
}
XElement targetVolNameElement = new XElement(XName.Get("TargetVolName", "http://windowscloudbackup.com/CiS/V2013_03"));
targetVolNameElement.Value = triggerCloneRequest.TargetVolName;
cloneRequestV2Element.Add(targetVolNameElement);

requestContent = requestDoc.ToString();
httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
Expand Down
6 changes: 3 additions & 3 deletions src/StorSimple/Generated/Models/TriggerCloneRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Snapshot SourceSnapshot
private IList<string> _targetACRIdList;

/// <summary>
/// Required. List of existing access control records to add to the
/// Optional. List of existing access control records to add to the
/// cloned volume
/// </summary>
public IList<string> TargetACRIdList
Expand All @@ -81,7 +81,7 @@ public IList<string> TargetACRIdList
private IList<AccessControlRecord> _targetACRList;

/// <summary>
/// Required. List of new access control records to add to the cloned
/// Optional. List of new access control records to add to the cloned
/// volume
/// </summary>
public IList<AccessControlRecord> TargetACRList
Expand All @@ -104,7 +104,7 @@ public string TargetDeviceId
private string _targetVolName;

/// <summary>
/// Optional. Name of the cloned volume
/// Required. Name of the cloned volume
/// </summary>
public string TargetVolName
{
Expand Down
12 changes: 12 additions & 0 deletions src/StorSimple/Generated/Models/VirtualDeviceProvisioningInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ public bool CreateNewStorageAccount
set { this._createNewStorageAccount = value; }
}

private bool? _deleteAzureCisVMOnFailure;

/// <summary>
/// Optional. The boolean value to retain Azure VM on failure for
/// debugging purposes.
/// </summary>
public bool? DeleteAzureCisVMOnFailure
{
get { return this._deleteAzureCisVMOnFailure; }
set { this._deleteAzureCisVMOnFailure = value; }
}

private string _deviceName;

/// <summary>
Expand Down
15 changes: 15 additions & 0 deletions src/StorSimple/Generated/VirtualDeviceOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ public async Task<JobResponse> CreateAsync(VirtualDeviceProvisioningInfo virtual
virtualNetworkNameElement.Value = virtualDeviceProvisioningInfo.VirtualNetworkName;
virtualApplianceProvisioningInfoElement.Add(virtualNetworkNameElement);

if (virtualDeviceProvisioningInfo.DeleteAzureCisVMOnFailure != null)
{
XElement deleteAzureCisVMOnFailureElement = new XElement(XName.Get("DeleteAzureCisVMOnFailure", "http://windowscloudbackup.com/CiS/V2013_03"));
deleteAzureCisVMOnFailureElement.Value = virtualDeviceProvisioningInfo.DeleteAzureCisVMOnFailure.ToString().ToLower();
virtualApplianceProvisioningInfoElement.Add(deleteAzureCisVMOnFailureElement);
}
else
{
XElement emptyElement = new XElement(XName.Get("DeleteAzureCisVMOnFailure", "http://windowscloudbackup.com/CiS/V2013_03"));
XAttribute nilAttribute = new XAttribute(XName.Get("nil", "http://www.w3.org/2001/XMLSchema-instance"), "");
nilAttribute.Value = "true";
emptyElement.Add(nilAttribute);
virtualApplianceProvisioningInfoElement.Add(emptyElement);
}

requestContent = requestDoc.ToString();
httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/xml");
Expand Down

0 comments on commit ad0d5f4

Please sign in to comment.