/// <summary>
 /// The Get Package By Slot operation retrieves a cloud service package
 /// for a deployment and stores the package files in Azure Blob
 /// storage. The following package files are placed in storage: the
 /// cloud service configuration file (.cscfg), providing configuration
 /// settings for the cloud service and individual roles, including the
 /// number of role instances; and the service package (.cspkg),
 /// containing the application code and the service definition file.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='deploymentSlot'>
 /// Required. The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Package By Slot operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> BeginGettingPackageBySlotAsync(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentGetPackageParameters parameters)
 {
     return operations.BeginGettingPackageBySlotAsync(serviceName, deploymentSlot, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Get Package By Slot operation retrieves a cloud service package
 /// for a deployment and stores the package files in Azure Blob
 /// storage. The following package files are placed in storage: the
 /// cloud service configuration file (.cscfg), providing configuration
 /// settings for the cloud service and individual roles, including the
 /// number of role instances; and the service package (.cspkg),
 /// containing the application code and the service definition file.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='deploymentSlot'>
 /// Required. The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Package By Slot operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse BeginGettingPackageBySlot(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentGetPackageParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IDeploymentOperations)s).BeginGettingPackageBySlotAsync(serviceName, deploymentSlot, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// The Get Package By Name operation retrieves a cloud service package
 /// for a deployment and stores the package files in Azure Blob
 /// storage. The following package files are placed in storage: the
 /// cloud service configuration file (.cscfg), providing configuration
 /// settings for the cloud service and individual roles, including the
 /// number of role instances; and the service package (.cspkg),
 /// containing the application code and the service definition file.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='deploymentName'>
 /// Required. The name of your deployment.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Package By Name operation.
 /// </param>
 /// <returns>
 /// The response body contains the status of the specified asynchronous
 /// operation, indicating whether it has succeeded, is inprogress, or
 /// has failed. Note that this status is distinct from the HTTP status
 /// code returned for the Get Operation Status operation itself. If
 /// the asynchronous operation succeeded, the response body includes
 /// the HTTP status code for the successful request. If the
 /// asynchronous operation failed, the response body includes the HTTP
 /// status code for the failed request and error information regarding
 /// the failure.
 /// </returns>
 public static Task<OperationStatusResponse> GetPackageByNameAsync(this IDeploymentOperations operations, string serviceName, string deploymentName, DeploymentGetPackageParameters parameters)
 {
     return operations.GetPackageByNameAsync(serviceName, deploymentName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Get Package By Name operation retrieves a cloud service package
 /// for a deployment and stores the package files in Azure Blob
 /// storage. The following package files are placed in storage: the
 /// cloud service configuration file (.cscfg), providing configuration
 /// settings for the cloud service and individual roles, including the
 /// number of role instances; and the service package (.cspkg),
 /// containing the application code and the service definition file.
 /// (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='deploymentName'>
 /// Required. The name of your deployment.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Package By Name operation.
 /// </param>
 /// <returns>
 /// The response body contains the status of the specified asynchronous
 /// operation, indicating whether it has succeeded, is inprogress, or
 /// has failed. Note that this status is distinct from the HTTP status
 /// code returned for the Get Operation Status operation itself. If
 /// the asynchronous operation succeeded, the response body includes
 /// the HTTP status code for the successful request. If the
 /// asynchronous operation failed, the response body includes the HTTP
 /// status code for the failed request and error information regarding
 /// the failure.
 /// </returns>
 public static OperationStatusResponse GetPackageByName(this IDeploymentOperations operations, string serviceName, string deploymentName, DeploymentGetPackageParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IDeploymentOperations)s).GetPackageByNameAsync(serviceName, deploymentName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// The Get Package operation retrieves a cloud service package for a
 /// deployment and stores the package files in Windows Azure Blob
 /// storage.  The following package files are placed in storage:
 /// Service configuration file - The cloud service configuration file
 /// (.cscfg) provides configuration settings for the cloud service and
 /// individual roles, including the number of role instances.
 /// Service package - The service package (.cspkg) contains the
 /// application code and the service definition file.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IDeploymentOperations.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the cloud service.
 /// </param>
 /// <param name='deploymentSlot'>
 /// The deployment slot.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Get Package operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse GetPackageBySlot(this IDeploymentOperations operations, string serviceName, DeploymentSlot deploymentSlot, DeploymentGetPackageParameters parameters)
 {
     try
     {
         return operations.GetPackageBySlotAsync(serviceName, deploymentSlot, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
        protected PSArgument[] CreateDeploymentGetPackageBySlotParameters()
        {
            string serviceName = string.Empty;
            DeploymentSlot deploymentSlot = new DeploymentSlot();
            DeploymentGetPackageParameters parameters = new DeploymentGetPackageParameters();

            return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentSlot", "Parameters" }, new object[] { serviceName, deploymentSlot, parameters });
        }