web/lib/Zend/Service/WindowsAzure/CommandLine/Deployment.php
changeset 1230 68c69c656a2c
parent 808 6b6c2214f778
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Service_Console
    16  * @package    Zend_Service_Console
    17  * @subpackage Exception
    17  * @subpackage Exception
    18  * @version    $Id$
    18  * @version    $Id$
    19  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * @see Zend_Service_Console_Command
    24  * @see Zend_Service_Console_Command
    25  */
    25  */
    26 require_once 'Zend/Service/Console/Command.php';
    26 require_once 'Zend/Service/Console/Command.php';
    27 
    27 
    28 /**
    28 /**
       
    29  * @see Zend_Service_WindowsAzure_Management_Client
       
    30  */
       
    31 require_once 'Zend/Service/WindowsAzure/Management/Client.php';
       
    32 
       
    33 /**
    29  * Deployment commands
    34  * Deployment commands
    30  * 
    35  *
    31  * @category   Zend
    36  * @category   Zend
    32  * @package    Zend_Service_WindowsAzure_CommandLine
    37  * @package    Zend_Service_WindowsAzure_CommandLine
    33  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    38  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    34  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    39  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    35  * 
    40  *
    36  * @command-handler deployment
    41  * @command-handler deployment
    37  * @command-handler-description Windows Azure Deployment commands
    42  * @command-handler-description Windows Azure Deployment commands
    38  * @command-handler-header Windows Azure SDK for PHP
    43  * @command-handler-header Windows Azure SDK for PHP
    39  * @command-handler-header Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
    44  * @command-handler-header Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
    40  * @command-handler-footer Note: Parameters that are common across all commands can be stored 
    45  * @command-handler-footer Note: Parameters that are common across all commands can be stored
    41  * @command-handler-footer in two dedicated environment variables.
    46  * @command-handler-footer in two dedicated environment variables.
    42  * @command-handler-footer - SubscriptionId: The Windows Azure Subscription Id to operate on.
    47  * @command-handler-footer - SubscriptionId: The Windows Azure Subscription Id to operate on.
    43  * @command-handler-footer - Certificate The Windows Azure .cer Management Certificate.
    48  * @command-handler-footer - Certificate The Windows Azure .cer Management Certificate.
    44  * @command-handler-footer 
    49  * @command-handler-footer
    45  * @command-handler-footer All commands support the --ConfigurationFile or -F parameter.
    50  * @command-handler-footer All commands support the --ConfigurationFile or -F parameter.
    46  * @command-handler-footer The parameter file is a simple INI file carrying one parameter
    51  * @command-handler-footer The parameter file is a simple INI file carrying one parameter
    47  * @command-handler-footer value per line. It accepts the same parameters as one can
    52  * @command-handler-footer value per line. It accepts the same parameters as one can
    48  * @command-handler-footer use from the command line command.
    53  * @command-handler-footer use from the command line command.
    49  */
    54  */
    50 class Zend_Service_WindowsAzure_CommandLine_Deployment
    55 class Zend_Service_WindowsAzure_CommandLine_Deployment
    51 	extends Zend_Service_Console_Command
    56 	extends Zend_Service_Console_Command
    52 {	
    57 {
    53 	/**
    58 	/**
    54 	 * Creates a deployment from a remote package file and service configuration.
    59 	 * Creates a deployment from a remote package file and service configuration.
    55 	 * 
    60 	 *
    56 	 * @command-name CreateFromStorage
    61 	 * @command-name CreateFromStorage
    57 	 * @command-description Creates a deployment from a remote package file and service configuration.
    62 	 * @command-description Creates a deployment from a remote package file and service configuration.
    58 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
    63 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
    59 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
    64 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
    60 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
    65 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
    90 		if ($waitForOperation) {
    95 		if ($waitForOperation) {
    91 			$client->waitForOperation();
    96 			$client->waitForOperation();
    92 		}
    97 		}
    93 		echo $client->getLastRequestId();
    98 		echo $client->getLastRequestId();
    94 	}
    99 	}
    95 	
   100 
    96 	/**
   101 	/**
    97 	 * Creates a deployment from a local package file and service configuration.
   102 	 * Creates a deployment from a local package file and service configuration.
    98 	 * 
   103 	 *
    99 	 * @command-name CreateFromLocal
   104 	 * @command-name CreateFromLocal
   100 	 * @command-description Creates a deployment from a local package file and service configuration.
   105 	 * @command-description Creates a deployment from a local package file and service configuration.
   101 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   106 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   102 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   107 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   103 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   108 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   132 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   137 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   133 		$blobClient = $client->createBlobClientForService($storageAccount);
   138 		$blobClient = $client->createBlobClientForService($storageAccount);
   134 		$blobClient->createContainerIfNotExists('phpazuredeployments');
   139 		$blobClient->createContainerIfNotExists('phpazuredeployments');
   135 		$blobClient->putBlob('phpazuredeployments', basename($packageLocation), $packageLocation);
   140 		$blobClient->putBlob('phpazuredeployments', basename($packageLocation), $packageLocation);
   136 		$package = $blobClient->getBlobInstance('phpazuredeployments', basename($packageLocation));
   141 		$package = $blobClient->getBlobInstance('phpazuredeployments', basename($packageLocation));
   137 		
   142 
   138 		$client->createDeployment($serviceName, $deploymentSlot, $deploymentName, $label, $package->Url, $serviceConfigurationLocation, $startImmediately, $warningsAsErrors);
   143 		$client->createDeployment($serviceName, $deploymentSlot, $deploymentName, $label, $package->Url, $serviceConfigurationLocation, $startImmediately, $warningsAsErrors);
   139 
   144 
   140 		$client->waitForOperation();
   145 		$client->waitForOperation();
   141 		$blobClient->deleteBlob('phpazuredeployments', basename($packageLocation));
   146 		$blobClient->deleteBlob('phpazuredeployments', basename($packageLocation));
   142 		
   147 
   143 		if ($waitForOperation) {
   148 		if ($waitForOperation) {
   144 			$client->waitForOperation();
   149 			$client->waitForOperation();
   145 		}
   150 		}
   146 		echo $client->getLastRequestId();
   151 		echo $client->getLastRequestId();
   147 	}
   152 	}
   148 	
   153 
   149 	/**
   154 	/**
   150 	 * Get deployment properties.
   155 	 * Get deployment properties.
   151 	 * 
   156 	 *
   152 	 * @command-name GetProperties
   157 	 * @command-name GetProperties
   153 	 * @command-description Get deployment properties.
   158 	 * @command-description Get deployment properties.
   154 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   159 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   155 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   160 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   156 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   161 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   161 	 * @command-example GetProperties -sid:"<your_subscription_id>" -cert:"mycert.pem" --Name:"servicename" --BySlot:"production"
   166 	 * @command-example GetProperties -sid:"<your_subscription_id>" -cert:"mycert.pem" --Name:"servicename" --BySlot:"production"
   162 	 */
   167 	 */
   163 	public function getPropertiesCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName)
   168 	public function getPropertiesCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName)
   164 	{
   169 	{
   165 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   170 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   166 		
   171 
   167 		$result = null;
   172 		$result = null;
   168 		
   173 
   169 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   174 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   170 			$deploymentSlot = strtolower($deploymentSlot);
   175 			$deploymentSlot = strtolower($deploymentSlot);
   171 			
   176 
   172 			$result = $client->getDeploymentBySlot($serviceName, $deploymentSlot);
   177 			$result = $client->getDeploymentBySlot($serviceName, $deploymentSlot);
   173 		} else {
   178 		} else {
   174 			$result = $client->getDeploymentByDeploymentId($serviceName, $deploymentName);
   179 			$result = $client->getDeploymentByDeploymentId($serviceName, $deploymentName);
   175 		}
   180 		}
   176 
   181 
   177 		$this->_displayObjectInformation($result, array('Name', 'DeploymentSlot', 'Label', 'Url', 'Status'));
   182 		$this->_displayObjectInformation($result, array('Name', 'DeploymentSlot', 'Label', 'Url', 'Status'));
   178 	}
   183 	}
   179 	
   184 
   180 	/**
   185 	/**
   181 	 * Get hosted service account property.
   186 	 * Get hosted service account property.
   182 	 * 
   187 	 *
   183 	 * @command-name GetProperty
   188 	 * @command-name GetProperty
   184 	 * @command-description Get deployment property.
   189 	 * @command-description Get deployment property.
   185 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   190 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   186 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   191 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   187 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   192 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   194 	 * @command-example --Name:"servicename" --BySlot:"production" --Property:"Name"
   199 	 * @command-example --Name:"servicename" --BySlot:"production" --Property:"Name"
   195 	 */
   200 	 */
   196 	public function getPropertyCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $property)
   201 	public function getPropertyCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $property)
   197 	{
   202 	{
   198 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   203 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   199 		
   204 
   200 		$result = null;
   205 		$result = null;
   201 		
   206 
   202 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   207 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   203 			$deploymentSlot = strtolower($deploymentSlot);
   208 			$deploymentSlot = strtolower($deploymentSlot);
   204 			
   209 
   205 			$result = $client->getDeploymentBySlot($serviceName, $deploymentSlot);
   210 			$result = $client->getDeploymentBySlot($serviceName, $deploymentSlot);
   206 		} else {
   211 		} else {
   207 			$result = $client->getDeploymentByDeploymentId($serviceName, $deploymentName);
   212 			$result = $client->getDeploymentByDeploymentId($serviceName, $deploymentName);
   208 		}
   213 		}
   209 
   214 
   210 		printf("%s\r\n", $result->$property);
   215 		printf("%s\r\n", $result->$property);
   211 	}
   216 	}
   212 	
   217 
   213 	/**
   218 	/**
   214 	 * Swap deployment slots (perform VIP swap).
   219 	 * Swap deployment slots (perform VIP swap).
   215 	 * 
   220 	 *
   216 	 * @command-name Swap
   221 	 * @command-name Swap
   217 	 * @command-description Swap deployment slots (perform VIP swap).
   222 	 * @command-description Swap deployment slots (perform VIP swap).
   218 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   223 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   219 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   224 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   220 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   225 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   224 	 * @command-example Swap -sid:"<your_subscription_id>" -cert:"mycert.pem" --Name:"servicename"
   229 	 * @command-example Swap -sid:"<your_subscription_id>" -cert:"mycert.pem" --Name:"servicename"
   225 	 */
   230 	 */
   226 	public function swapCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $waitForOperation = false)
   231 	public function swapCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $waitForOperation = false)
   227 	{
   232 	{
   228 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   233 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   229 		
   234 
   230 		$productionDeploymentName = null;
   235 		$productionDeploymentName = null;
   231 		try { $productionDeploymentName = $client->getDeploymentBySlot($serviceName, 'production')->Name; } catch (Exception $ex) {}
   236 		try { $productionDeploymentName = $client->getDeploymentBySlot($serviceName, 'production')->Name; } catch (Exception $ex) {}
   232 		
   237 
   233 		$stagingDeploymentName = null;
   238 		$stagingDeploymentName = null;
   234 		try { $stagingDeploymentName = $client->getDeploymentBySlot($serviceName, 'staging')->Name; } catch (Exception $ex) {}
   239 		try { $stagingDeploymentName = $client->getDeploymentBySlot($serviceName, 'staging')->Name; } catch (Exception $ex) {}
   235 		
   240 
   236 		if (is_null($productionDeploymentName)) {
   241 		if (is_null($productionDeploymentName)) {
   237 			$productionDeploymentName = $stagingDeploymentName;
   242 			$productionDeploymentName = $stagingDeploymentName;
   238 		}
   243 		}
   239 		if (is_null($stagingDeploymentName)) {
   244 		if (is_null($stagingDeploymentName)) {
   240 			require_once 'Zend/Service/Console/Exception.php';
   245 			require_once 'Zend/Service/Console/Exception.php';
   241 			throw new Zend_Service_Console_Exception('Swapping deployment slots is only possible when both slots have an active deployment or when production slot is empty.');
   246 			throw new Zend_Service_Console_Exception('Swapping deployment slots is only possible when both slots have an active deployment or when production slot is empty.');
   242 		}
   247 		}
   243 
   248 
   244 		$client->swapDeployment($serviceName, $productionDeploymentName, $stagingDeploymentName);
   249 		$client->swapDeployment($serviceName, $productionDeploymentName, $stagingDeploymentName);
   245 		
   250 
   246 		if ($waitForOperation) {
   251 		if ($waitForOperation) {
   247 			$client->waitForOperation();
   252 			$client->waitForOperation();
   248 		}
   253 		}
   249 		echo $client->getLastRequestId();
   254 		echo $client->getLastRequestId();
   250 	}
   255 	}
   251 	
   256 
   252 	/**
   257 	/**
   253 	 * Deletes a deployment.
   258 	 * Deletes a deployment.
   254 	 * 
   259 	 *
   255 	 * @command-name Delete
   260 	 * @command-name Delete
   256 	 * @command-description Deletes a deployment.
   261 	 * @command-description Deletes a deployment.
   257 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   262 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   258 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   263 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   259 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   264 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   268 	{
   273 	{
   269 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   274 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   270 
   275 
   271 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   276 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   272 			$deploymentSlot = strtolower($deploymentSlot);
   277 			$deploymentSlot = strtolower($deploymentSlot);
   273 			
   278 
   274 			$client->deleteDeploymentBySlot($serviceName, $deploymentSlot);
   279 			$client->deleteDeploymentBySlot($serviceName, $deploymentSlot);
   275 		} else {
   280 		} else {
   276 			$client->deleteDeploymentByDeploymentId($serviceName, $deploymentName);
   281 			$client->deleteDeploymentByDeploymentId($serviceName, $deploymentName);
   277 		}
   282 		}
   278 		
   283 
   279 		if ($waitForOperation) {
   284 		if ($waitForOperation) {
   280 			$client->waitForOperation();
   285 			$client->waitForOperation();
   281 		}
   286 		}
   282 		echo $client->getLastRequestId();
   287 		echo $client->getLastRequestId();
   283 	}
   288 	}
   284 	
   289 
   285 	/**
   290 	/**
   286 	 * Updates a deployment's configuration.
   291 	 * Updates a deployment's configuration.
   287 	 * 
   292 	 *
   288 	 * @command-name UpdateConfig
   293 	 * @command-name UpdateConfig
   289 	 * @command-description Updates a deployment's configuration.
   294 	 * @command-description Updates a deployment's configuration.
   290 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   295 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   291 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   296 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   292 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   297 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   304 	{
   309 	{
   305 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   310 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   306 
   311 
   307 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   312 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   308 			$deploymentSlot = strtolower($deploymentSlot);
   313 			$deploymentSlot = strtolower($deploymentSlot);
   309 			
   314 
   310 			$client->configureDeploymentBySlot($serviceName, $deploymentSlot, $serviceConfigurationLocation);
   315 			$client->configureDeploymentBySlot($serviceName, $deploymentSlot, $serviceConfigurationLocation);
   311 		} else {
   316 		} else {
   312 			$client->configureDeploymentByDeploymentId($serviceName, $deploymentName, $serviceConfigurationLocation);
   317 			$client->configureDeploymentByDeploymentId($serviceName, $deploymentName, $serviceConfigurationLocation);
   313 		}
   318 		}
   314 		
   319 
   315 		if ($waitForOperation) {
   320 		if ($waitForOperation) {
   316 			$client->waitForOperation();
   321 			$client->waitForOperation();
   317 		}
   322 		}
   318 		echo $client->getLastRequestId();
   323 		echo $client->getLastRequestId();
   319 	}
   324 	}
   320 	
   325 
   321 	/**
   326 	/**
   322 	 * Updates a deployment's status.
   327 	 * Updates a deployment's status.
   323 	 * 
   328 	 *
   324 	 * @command-name UpdateStatus
   329 	 * @command-name UpdateStatus
   325 	 * @command-description Updates a deployment's status.
   330 	 * @command-description Updates a deployment's status.
   326 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   331 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   327 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   332 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   328 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   333 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   340 	{
   345 	{
   341 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   346 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   342 
   347 
   343 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   348 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   344 			$deploymentSlot = strtolower($deploymentSlot);
   349 			$deploymentSlot = strtolower($deploymentSlot);
   345 			
   350 
   346 			$client->updateDeploymentStatusBySlot($serviceName, $deploymentSlot, $newStatus);
   351 			$client->updateDeploymentStatusBySlot($serviceName, $deploymentSlot, $newStatus);
   347 		} else {
   352 		} else {
   348 			$client->updateDeploymentStatusByDeploymentId($serviceName, $deploymentName, $newStatus);
   353 			$client->updateDeploymentStatusByDeploymentId($serviceName, $deploymentName, $newStatus);
   349 		}
   354 		}
   350 		
   355 
   351 		if ($waitForOperation) {
   356 		if ($waitForOperation) {
   352 			$client->waitForOperation();
   357 			$client->waitForOperation();
   353 		}
   358 		}
   354 		echo $client->getLastRequestId();
   359 		echo $client->getLastRequestId();
   355 	}
   360 	}
   356 	
   361 
   357 	/**
   362 	/**
   358 	 * Updates the number of instances.
   363 	 * Updates the number of instances.
   359 	 * 
   364 	 *
   360 	 * @command-name EditInstanceNumber
   365 	 * @command-name EditInstanceNumber
   361 	 * @command-description Updates the number of instances.
   366 	 * @command-description Updates the number of instances.
   362 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   367 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   363 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   368 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   364 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   369 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   377 	{
   382 	{
   378 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   383 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   379 
   384 
   380 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   385 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   381 			$deploymentSlot = strtolower($deploymentSlot);
   386 			$deploymentSlot = strtolower($deploymentSlot);
   382 			
   387 
   383 			$client->setInstanceCountBySlot($serviceName, $deploymentSlot, $roleName, $newInstanceNumber);
   388 			$client->setInstanceCountBySlot($serviceName, $deploymentSlot, $roleName, $newInstanceNumber);
   384 		} else {
   389 		} else {
   385 			$client->setInstanceCountByDeploymentId($serviceName, $deploymentName, $roleName, $newInstanceNumber);
   390 			$client->setInstanceCountByDeploymentId($serviceName, $deploymentName, $roleName, $newInstanceNumber);
   386 		}
   391 		}
   387 		
   392 
   388 		if ($waitForOperation) {
   393 		if ($waitForOperation) {
   389 			$client->waitForOperation();
   394 			$client->waitForOperation();
   390 		}
   395 		}
   391 		echo $client->getLastRequestId();
   396 		echo $client->getLastRequestId();
   392 	}
   397 	}
   393 	
   398 
   394 	/**
   399 	/**
   395 	 * Reboots a role instance.
   400 	 * Reboots a role instance.
   396 	 * 
   401 	 *
   397 	 * @command-name RebootInstance
   402 	 * @command-name RebootInstance
   398 	 * @command-description Reboots a role instance.
   403 	 * @command-description Reboots a role instance.
   399 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   404 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   400 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   405 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   401 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   406 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   413 	{
   418 	{
   414 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   419 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   415 
   420 
   416 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   421 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   417 			$deploymentSlot = strtolower($deploymentSlot);
   422 			$deploymentSlot = strtolower($deploymentSlot);
   418 			
   423 
   419 			$client->rebootRoleInstanceBySlot($serviceName, $deploymentSlot, $instanceName);
   424 			$client->rebootRoleInstanceBySlot($serviceName, $deploymentSlot, $instanceName);
   420 		} else {
   425 		} else {
   421 			$client->rebootRoleInstanceByDeploymentId($serviceName, $deploymentName, $instanceName);
   426 			$client->rebootRoleInstanceByDeploymentId($serviceName, $deploymentName, $instanceName);
   422 		}
   427 		}
   423 		
   428 
   424 		if ($waitForOperation) {
   429 		if ($waitForOperation) {
   425 			$client->waitForOperation();
   430 			$client->waitForOperation();
   426 		}
   431 		}
   427 		echo $client->getLastRequestId();
   432 		echo $client->getLastRequestId();
   428 	}
   433 	}
   429 	
   434 
   430 	/**
   435 	/**
   431 	 * Reimages a role instance.
   436 	 * Reimages a role instance.
   432 	 * 
   437 	 *
   433 	 * @command-name ReimageInstance
   438 	 * @command-name ReimageInstance
   434 	 * @command-description Reimages a role instance.
   439 	 * @command-description Reimages a role instance.
   435 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   440 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   436 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   441 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   437 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   442 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   449 	{
   454 	{
   450 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   455 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   451 
   456 
   452 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   457 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   453 			$deploymentSlot = strtolower($deploymentSlot);
   458 			$deploymentSlot = strtolower($deploymentSlot);
   454 			
   459 
   455 			$client->reimageRoleInstanceBySlot($serviceName, $deploymentSlot, $instanceName);
   460 			$client->reimageRoleInstanceBySlot($serviceName, $deploymentSlot, $instanceName);
   456 		} else {
   461 		} else {
   457 			$client->reimageRoleInstanceByDeploymentId($serviceName, $deploymentName, $instanceName);
   462 			$client->reimageRoleInstanceByDeploymentId($serviceName, $deploymentName, $instanceName);
   458 		}
   463 		}
   459 		
   464 
   460 		if ($waitForOperation) {
   465 		if ($waitForOperation) {
   461 			$client->waitForOperation();
   466 			$client->waitForOperation();
   462 		}
   467 		}
   463 		echo $client->getLastRequestId();
   468 		echo $client->getLastRequestId();
   464 	}
   469 	}
   465 	
   470 
   466 	/**
   471 	/**
   467 	 * Upgrades a deployment from a remote package file and service configuration.
   472 	 * Upgrades a deployment from a remote package file and service configuration.
   468 	 * 
   473 	 *
   469 	 * @command-name UpgradeFromStorage
   474 	 * @command-name UpgradeFromStorage
   470 	 * @command-description Upgrades a deployment from a remote package file and service configuration.
   475 	 * @command-description Upgrades a deployment from a remote package file and service configuration.
   471 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   476 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   472 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   477 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   473 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   478 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   480 	 * @command-parameter-for $mode Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Mode Required. Set to auto|manual.
   485 	 * @command-parameter-for $mode Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Mode Required. Set to auto|manual.
   481 	 * @command-parameter-for $roleName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --RoleName Optional. Role name to upgrade.
   486 	 * @command-parameter-for $roleName Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --RoleName Optional. Role name to upgrade.
   482 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   487 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   483 	 */
   488 	 */
   484 	public function upgradeFromStorageCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $label, $packageUrl, $serviceConfigurationLocation, $mode = 'auto', $roleName = null, $waitForOperation = false)
   489 	public function upgradeFromStorageCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $label, $packageUrl, $serviceConfigurationLocation, $mode = 'auto', $roleName = null, $waitForOperation = false)
   485 	{		
   490 	{
   486 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   491 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   487 
   492 
   488 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   493 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   489 			$deploymentSlot = strtolower($deploymentSlot);
   494 			$deploymentSlot = strtolower($deploymentSlot);
   490 			
   495 
   491 			$client->upgradeDeploymentBySlot($serviceName, $deploymentSlot, $label, $packageUrl, $serviceConfigurationLocation, $mode, $roleName);
   496 			$client->upgradeDeploymentBySlot($serviceName, $deploymentSlot, $label, $packageUrl, $serviceConfigurationLocation, $mode, $roleName);
   492 		} else {
   497 		} else {
   493 			$client->upgradeDeploymentByDeploymentId($serviceName, $deploymentName, $label, $packageUrl, $serviceConfigurationLocation, $mode, $roleName);
   498 			$client->upgradeDeploymentByDeploymentId($serviceName, $deploymentName, $label, $packageUrl, $serviceConfigurationLocation, $mode, $roleName);
   494 		}
   499 		}
   495 		
   500 
   496 		if ($waitForOperation) {
   501 		if ($waitForOperation) {
   497 			$client->waitForOperation();
   502 			$client->waitForOperation();
   498 		}
   503 		}
   499 		echo $client->getLastRequestId();
   504 		echo $client->getLastRequestId();
   500 	}
   505 	}
   501 	
   506 
   502 	/**
   507 	/**
   503 	 * Upgrades a deployment from a local package file and service configuration.
   508 	 * Upgrades a deployment from a local package file and service configuration.
   504 	 * 
   509 	 *
   505 	 * @command-name UpgradeFromLocal
   510 	 * @command-name UpgradeFromLocal
   506 	 * @command-description Upgrades a deployment from a local package file and service configuration.
   511 	 * @command-description Upgrades a deployment from a local package file and service configuration.
   507 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   512 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   508 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   513 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   509 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   514 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   519 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   524 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   520 	 */
   525 	 */
   521 	public function upgradeFromLocalCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $label, $packageLocation, $serviceConfigurationLocation, $storageAccount, $mode = 'auto', $roleName = null, $waitForOperation = false)
   526 	public function upgradeFromLocalCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $label, $packageLocation, $serviceConfigurationLocation, $storageAccount, $mode = 'auto', $roleName = null, $waitForOperation = false)
   522 	{
   527 	{
   523 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   528 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   524 		
   529 
   525 		$blobClient = $client->createBlobClientForService($storageAccount);
   530 		$blobClient = $client->createBlobClientForService($storageAccount);
   526 		$blobClient->createContainerIfNotExists('phpazuredeployments');
   531 		$blobClient->createContainerIfNotExists('phpazuredeployments');
   527 		$blobClient->putBlob('phpazuredeployments', basename($packageLocation), $packageLocation);
   532 		$blobClient->putBlob('phpazuredeployments', basename($packageLocation), $packageLocation);
   528 		$package = $blobClient->getBlobInstance('phpazuredeployments', basename($packageLocation));
   533 		$package = $blobClient->getBlobInstance('phpazuredeployments', basename($packageLocation));
   529 		
   534 
   530 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   535 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   531 			$deploymentSlot = strtolower($deploymentSlot);
   536 			$deploymentSlot = strtolower($deploymentSlot);
   532 			
   537 
   533 			$client->upgradeDeploymentBySlot($serviceName, $deploymentSlot, $label, $package->Url, $serviceConfigurationLocation, $mode, $roleName);
   538 			$client->upgradeDeploymentBySlot($serviceName, $deploymentSlot, $label, $package->Url, $serviceConfigurationLocation, $mode, $roleName);
   534 		} else {
   539 		} else {
   535 			$client->upgradeDeploymentByDeploymentId($serviceName, $deploymentName, $label, $package->Url, $serviceConfigurationLocation, $mode, $roleName);
   540 			$client->upgradeDeploymentByDeploymentId($serviceName, $deploymentName, $label, $package->Url, $serviceConfigurationLocation, $mode, $roleName);
   536 		}
   541 		}
   537 		
   542 
   538 		$client->waitForOperation();
   543 		$client->waitForOperation();
   539 		$blobClient->deleteBlob('phpazuredeployments', basename($packageLocation));
   544 		$blobClient->deleteBlob('phpazuredeployments', basename($packageLocation));
   540 		
   545 
   541 		if ($waitForOperation) {
   546 		if ($waitForOperation) {
   542 			$client->waitForOperation();
   547 			$client->waitForOperation();
   543 		}
   548 		}
   544 		echo $client->getLastRequestId();
   549 		echo $client->getLastRequestId();
   545 	}
   550 	}
   546 	
   551 
   547 	/**
   552 	/**
   548 	 * Walks upgrade domains.
   553 	 * Walks upgrade domains.
   549 	 * 
   554 	 *
   550 	 * @command-name WalkUpgradeDomains
   555 	 * @command-name WalkUpgradeDomains
   551 	 * @command-description Walks upgrade domains.
   556 	 * @command-description Walks upgrade domains.
   552 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   557 	 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
   553 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   558 	 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
   554 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   559 	 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
   559 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   564 	 * @command-parameter-for $waitForOperation Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
   560 	 */
   565 	 */
   561 	public function walkUpgradeDomainsCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $upgradeDomain, $waitForOperation = false)
   566 	public function walkUpgradeDomainsCommand($subscriptionId, $certificate, $certificatePassphrase, $serviceName, $deploymentSlot, $deploymentName, $upgradeDomain, $waitForOperation = false)
   562 	{
   567 	{
   563 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   568 		$client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase);
   564 		
   569 
   565 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   570 		if (!is_null($deploymentSlot) && $deploymentSlot != '') {
   566 			$deploymentSlot = strtolower($deploymentSlot);
   571 			$deploymentSlot = strtolower($deploymentSlot);
   567 			
   572 
   568 			$client->walkUpgradeDomainBySlot($serviceName, $deploymentSlot, $upgradeDomain);
   573 			$client->walkUpgradeDomainBySlot($serviceName, $deploymentSlot, $upgradeDomain);
   569 		} else {
   574 		} else {
   570 			$client->walkUpgradeDomainByDeploymentId($serviceName, $deploymentName, $upgradeDomain);
   575 			$client->walkUpgradeDomainByDeploymentId($serviceName, $deploymentName, $upgradeDomain);
   571 		}
   576 		}
   572 		
   577 
   573 		if ($waitForOperation) {
   578 		if ($waitForOperation) {
   574 			$client->waitForOperation();
   579 			$client->waitForOperation();
   575 		}
   580 		}
   576 		echo $client->getLastRequestId();
   581 		echo $client->getLastRequestId();
   577 	}
   582 	}