コード例 #1
0
 protected override void ValidateParameters()
 {
     base.ValidateParameters();
     if (!base.ParameterSetName.Equals("CreateService", StringComparison.OrdinalIgnoreCase))
     {
         if (!string.IsNullOrEmpty(this.Location) && !string.IsNullOrEmpty(this.AffinityGroup))
         {
             throw new ArgumentException("Location or AffinityGroup can only be specified when creating a new cloud service.");
         }
     }
     else
     {
         if (string.IsNullOrEmpty(this.Location) && string.IsNullOrEmpty(this.AffinityGroup))
         {
             throw new ArgumentException("Location or AffinityGroup is required when creating a new Cloud Service.");
         }
     }
     if (!base.ParameterSetName.Equals("CreateService", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(this.VNetName) || !string.IsNullOrEmpty(this.AffinityGroup))
     {
         if ((base.ParameterSetName.Equals("CreateService", StringComparison.OrdinalIgnoreCase) || base.ParameterSetName.Equals("CreateDeployment", StringComparison.OrdinalIgnoreCase)) && this.DnsSettings != null && string.IsNullOrEmpty(this.VNetName))
         {
             throw new ArgumentException("VNetName is required when specifying DNS Settings.");
         }
         else
         {
             PersistentVM[] vMs = this.VMs;
             int            num = 0;
             while (num < (int)vMs.Length)
             {
                 PersistentVM persistentVM = vMs[num];
                 ProvisioningConfigurationSet provisioningConfigurationSet = persistentVM.ConfigurationSets.OfType <ProvisioningConfigurationSet>().SingleOrDefault <ProvisioningConfigurationSet>();
                 if (provisioningConfigurationSet != null || persistentVM.OSVirtualHardDisk.SourceImageName == null)
                 {
                     num++;
                 }
                 else
                 {
                     throw new ArgumentException(string.Format("Virtual Machine {0} is missing provisioning configuration", persistentVM.RoleName));
                 }
             }
             return;
         }
     }
     else
     {
         throw new ArgumentException("Must specify the same affinity group as the virtual network is deployed to.");
     }
 }
コード例 #2
0
 public static void CaptureRole(this IServiceManagement proxy,
                                string subscriptionId,
                                string serviceName,
                                string deploymentName,
                                string roleInstanceName,
                                string targetImageName,
                                string targetImageLabel,
                                PostCaptureAction postCaptureAction,
                                ProvisioningConfigurationSet provisioningConfiguration)
 {
     proxy.EndExecuteRoleOperation(
         proxy.BeginExecuteRoleOperation(
             subscriptionId,
             serviceName,
             deploymentName,
             roleInstanceName,
             new CaptureRoleOperation
     {
         PostCaptureAction         = postCaptureAction.ToString(),
         ProvisioningConfiguration = provisioningConfiguration,
         TargetImageName           = targetImageName,
         TargetImageLabel          = targetImageLabel
     }, null, null));
 }
コード例 #3
0
 public static void CaptureRole(this IServiceManagement proxy,
 string subscriptionId,
 string serviceName,
 string deploymentName,
 string roleInstanceName,
 string targetImageName,
 string targetImageLabel,
 PostCaptureAction postCaptureAction,
 ProvisioningConfigurationSet provisioningConfiguration)
 {
     proxy.EndExecuteRoleOperation(
         proxy.BeginExecuteRoleOperation(
         subscriptionId,
         serviceName,
         deploymentName,
         roleInstanceName,
         new CaptureRoleOperation
         {
             PostCaptureAction = postCaptureAction.ToString(),
             ProvisioningConfiguration = provisioningConfiguration,
             TargetImageName = targetImageName,
             TargetImageLabel = targetImageLabel
         }, null, null));
 }