Microsoft_Console
[ class tree: Microsoft_Console ] [ index: Microsoft_Console ] [ all elements ]

Source for file Deployment.php

Documentation is available at Deployment.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2009 - 2011, RealDolmen
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions are met:
  8.  *     * Redistributions of source code must retain the above copyright
  9.  *       notice, this list of conditions and the following disclaimer.
  10.  *     * Redistributions in binary form must reproduce the above copyright
  11.  *       notice, this list of conditions and the following disclaimer in the
  12.  *       documentation and/or other materials provided with the distribution.
  13.  *     * Neither the name of RealDolmen nor the
  14.  *       names of its contributors may be used to endorse or promote products
  15.  *       derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY RealDolmen ''AS IS'' AND ANY
  18.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20.  * DISCLAIMED. IN NO EVENT SHALL RealDolmen BE LIABLE FOR ANY
  21.  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  *
  28.  * @category   Microsoft
  29.  * @package    Microsoft_Console
  30.  * @subpackage Exception
  31.  * @version    $Id: Exception.php 55733 2011-01-03 09:17:16Z unknown $
  32.  * @copyright  Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
  33.  * @license    http://phpazure.codeplex.com/license
  34.  */
  35.  
  36. /**
  37.  * @see Microsoft_AutoLoader
  38.  */
  39. require_once dirname(__FILE__'/../../AutoLoader.php';
  40.  
  41. /**
  42.  * Deployment commands
  43.  * 
  44.  * @category   Microsoft
  45.  * @package    Microsoft_WindowsAzure_CommandLine
  46.  * @copyright  Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
  47.  * @license    http://phpazure.codeplex.com/license
  48.  * 
  49.  * @command-handler deployment
  50.  * @command-handler-description Windows Azure Deployment commands
  51.  * @command-handler-header Windows Azure SDK for PHP
  52.  * @command-handler-header Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
  53.  * @command-handler-footer Note: Parameters that are common across all commands can be stored
  54.  * @command-handler-footer in two dedicated environment variables.
  55.  * @command-handler-footer - SubscriptionId: The Windows Azure Subscription Id to operate on.
  56.  * @command-handler-footer - Certificate The Windows Azure .cer Management Certificate.
  57.  * @command-handler-footer
  58.  * @command-handler-footer All commands support the --ConfigurationFile or -F parameter.
  59.  * @command-handler-footer The parameter file is a simple INI file carrying one parameter
  60.  * @command-handler-footer value per line. It accepts the same parameters as one can
  61.  * @command-handler-footer use from the command line command.
  62.  */
  63.     extends Microsoft_Console_Command
  64. {    
  65.     /**
  66.      * Creates a deployment from a remote package file and service configuration.
  67.      * 
  68.      * @command-name CreateFromStorage
  69.      * @command-description Creates a deployment from a remote package file and service configuration.
  70.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  71.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  72.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  73.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Name Required. The hosted service DNS name to operate on.
  74.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --DeploymentName Required. The name for the deployment.
  75.      * @command-parameter-for $label Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment.
  76.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required. The slot to deploy to.
  77.      * @command-parameter-for $packageUrl Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --PackageUrl Required. The remote location of the .cspkg file.
  78.      * @command-parameter-for $serviceConfigurationLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file.
  79.      * @command-parameter-for $startImmediately Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --StartImmediately Optional. Start the deployment after creation.
  80.      * @command-parameter-for $warningsAsErrors Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WarningsAsErrors Optional. Treat warnings as errors.
  81.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  82.      * @command-example Create a deployment from a remote .cspkg:
  83.      * @command-example CreateFromStorage -sid="<your_subscription_id>" -cert="mycert.pem" --Name="hostedservicename" --DeploymentName="deploymentname"
  84.      * @command-example --Label="deploymentlabel" --BySlot="production"
  85.      * @command-example --PackageUrl="http://acct.blob.core.windows.net/pkgs/service.cspkg"
  86.      * @command-example --ServiceConfigLocation=".\ServiceConfiguration.cscfg" --StartImmediately --WaitFor
  87.      */
  88.     public function createFromStorageCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentName$label$deploymentSlot$packageUrl$serviceConfigurationLocation$startImmediately true$warningsAsErrors false$waitForOperation false)
  89.     {
  90.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  91.             $deploymentSlot strtolower($deploymentSlot);
  92.         }
  93.         if ($deploymentSlot != 'staging' && $deploymentSlot != 'production'{
  94.             throw new Microsoft_Console_Exception('The deployment slot specified should be either staging|production.');
  95.         }
  96.  
  97.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  98.         $client->createDeployment($serviceName$deploymentSlot$deploymentName$label$packageUrl$serviceConfigurationLocation$startImmediately$warningsAsErrors);
  99.  
  100.         if ($waitForOperation{
  101.             $client->waitForOperation();
  102.         }
  103.         echo $client->getLastRequestId();
  104.     }
  105.     
  106.     /**
  107.      * Creates a deployment from a local package file and service configuration.
  108.      * 
  109.      * @command-name CreateFromLocal
  110.      * @command-description Creates a deployment from a local package file and service configuration.
  111.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  112.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  113.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  114.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Name Required. The hosted service DNS name to operate on.
  115.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --DeploymentName Required. The name for the deployment.
  116.      * @command-parameter-for $label Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment.
  117.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required. The slot to deploy to.
  118.      * @command-parameter-for $packageLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --PackageLocation Required. The location of the .cspkg file.
  119.      * @command-parameter-for $serviceConfigurationLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file.
  120.      * @command-parameter-for $storageAccount Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --StorageAccount Required. Storage account to use when creating the deployment.
  121.      * @command-parameter-for $startImmediately Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --StartImmediately Optional. Start the deployment after creation.
  122.      * @command-parameter-for $warningsAsErrors Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WarningsAsErrors Optional. Treat warnings as errors.
  123.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  124.      * @command-example Create a deployment from a local .cspkg:
  125.      * @command-example CreateFromLocal -sid="<your_subscription_id>" -cert="mycert.pem" --Name="hostedservicename" --DeploymentName="deploymentname"
  126.      * @command-example --Label="deploymentlabel" --BySlot="production" --PackageLocation=".\service.cspkg"
  127.      * @command-example --ServiceConfigLocation=".\ServiceConfiguration.cscfg" --StorageAccount="mystorage"
  128.      * @command-example --StartImmediately --WaitFor
  129.      */
  130.     public function createFromLocalCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentName$label$deploymentSlot$packageLocation$serviceConfigurationLocation$storageAccount$startImmediately true$warningsAsErrors false$waitForOperation false)
  131.     {
  132.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  133.             $deploymentSlot strtolower($deploymentSlot);
  134.         }
  135.         if ($deploymentSlot != 'staging' && $deploymentSlot != 'production'{
  136.             throw new Microsoft_Console_Exception('The deployment slot specified should be either staging|production.');
  137.         }
  138.  
  139.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  140.         $blobClient $client->createBlobClientForService($storageAccount);
  141.         $blobClient->createContainerIfNotExists('phpazuredeployments');
  142.         $blobClient->putBlob('phpazuredeployments'basename($packageLocation)$packageLocation);
  143.         $package $blobClient->getBlobInstance('phpazuredeployments'basename($packageLocation));
  144.         
  145.         $client->createDeployment($serviceName$deploymentSlot$deploymentName$label$package->Url$serviceConfigurationLocation$startImmediately$warningsAsErrors);
  146.  
  147.         $client->waitForOperation();
  148.         $blobClient->deleteBlob('phpazuredeployments'basename($packageLocation));
  149.         
  150.         if ($waitForOperation{
  151.             $client->waitForOperation();
  152.         }
  153.         echo $client->getLastRequestId();
  154.     }
  155.     
  156.     /**
  157.      * Get deployment properties.
  158.      * 
  159.      * @command-name GetProperties
  160.      * @command-description Get deployment properties.
  161.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  162.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  163.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  164.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  165.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  166.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  167.      * @command-example Get deployment properties for service "phptest" (production slot):
  168.      * @command-example GetProperties -sid="<your_subscription_id>" -cert="mycert.pem" --Name="servicename" --BySlot="production"
  169.      */
  170.     public function getPropertiesCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName)
  171.     {
  172.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  173.         
  174.         $result null;
  175.         
  176.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  177.             $deploymentSlot strtolower($deploymentSlot);
  178.             
  179.             $result $client->getDeploymentBySlot($serviceName$deploymentSlot);
  180.         else {
  181.             $result $client->getDeploymentByDeploymentId($serviceName$deploymentName);
  182.         }
  183.  
  184.         $this->_displayObjectInformation($resultarray('Name''DeploymentSlot''Label''Url''Status'))
  185.     }
  186.     
  187.     /**
  188.      * Get hosted service account property.
  189.      * 
  190.      * @command-name GetProperty
  191.      * @command-description Get deployment property.
  192.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  193.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  194.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  195.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  196.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  197.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  198.      * @command-parameter-for $property Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Property|-prop Required. The property to retrieve for the hosted service account.
  199.      * @command-example Get deployment property "Name" for service "phptest" (production slot):
  200.      * @command-example GetProperties -sid="<your_subscription_id>" -cert="mycert.pem"
  201.      * @command-example --Name="servicename" --BySlot="production" --Property="Name"
  202.      */
  203.     public function getPropertyCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$property)
  204.     {
  205.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  206.         
  207.         $result null;
  208.         
  209.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  210.             $deploymentSlot strtolower($deploymentSlot);
  211.             
  212.             $result $client->getDeploymentBySlot($serviceName$deploymentSlot);
  213.         else {
  214.             $result $client->getDeploymentByDeploymentId($serviceName$deploymentName);
  215.         }
  216.         
  217.         printf("%s\r\n"$result->$property);
  218.     }
  219.     
  220.     /**
  221.      * Get role instances.
  222.      * 
  223.      * @command-name GetRoleInstances
  224.      * @command-description Get role instance information (instance count, instance names, and instance statuses for a specified deployment.
  225.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  226.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  227.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  228.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  229.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  230.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  231.      * @command-example Get role instances for production-slot deployment of the hosted service "phptest":
  232.      * @command-example GetRoleInstances -sid="<your_subscription_id>" -cert="mycert.pem"
  233.      * @command-example --Name="servicename" --BySlot="production"
  234.      */
  235.     public function getRoleInstances($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName)
  236.     {
  237.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  238.         
  239.         $result null;
  240.         
  241.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  242.             $deploymentSlot strtolower($deploymentSlot);
  243.             
  244.             $result $client->getRoleInstancesByDeploymentSlot($serviceName$deploymentSlot);
  245.         else {
  246.             $result $client->getRoleInstancesByDeploymentId($serviceName$deploymentName);
  247.         }
  248.         
  249.         printf("InstanceCount:%s\n\n"count($result));
  250.         $instance_index 0;
  251.         foreach($result as $instance{
  252.             printf("Instance%s\n"$instance_index );
  253.             printf("Name:%s\n"$instance['instancename']);
  254.             printf("Status:%s\n"$instance['instancestatus']);
  255.             printf("\n");
  256.             $instance_index++;
  257.         }
  258.     }
  259.     
  260.     /**
  261.      * Get role instance properties.
  262.      * 
  263.      * @command-name GetRoleInstanceProperties
  264.      * @command-description Get role instance information for a specified role instance.
  265.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  266.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  267.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  268.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  269.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  270.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  271.      * @command-parameter-for $instanceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --InstanceName Required. The role instance name to retrieve properties for.
  272.      * @command-example Get role instance properties for role "role_0" for production-slot deployment of the hosted service "phptest":
  273.      * @command-example GetRoleInstances -sid="<your_subscription_id>" -cert="mycert.pem"
  274.      * @command-example --Name="servicename" --BySlot="production" --InstanceName="role_0"
  275.      */
  276.     public function getRoleInstanceProperties($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$instanceName)
  277.     {
  278.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  279.         
  280.         $result null;
  281.         
  282.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  283.             $deploymentSlot strtolower($deploymentSlot);
  284.             
  285.             $result $client->getRoleInstancesByDeploymentSlot($serviceName$deploymentSlot);
  286.         else {
  287.             $result $client->getRoleInstancesByDeploymentId($serviceName$deploymentName);
  288.         }
  289.         
  290.         $instance_found false;
  291.         
  292.         foreach($result as $instance{
  293.             if($instance['instancename'== $instanceName{
  294.                 printf("Status: \t%s\n"$instance['instancestatus']);
  295.                 printf("Upgrade domain: %s\n"$instance['instanceupgradedomain']);
  296.                 printf("Fault domain: \t%s\n"$instance['instancefaultdomain']);
  297.                 printf("Size: \t\t%s\n"$instance['instancesize']);
  298.                 printf("\n");
  299.                 $instance_found true;
  300.                 continue;
  301.             }
  302.         }
  303.         
  304.         if(!$instance_found{
  305.                 printf("No instance with name %s was found."$instanceName);
  306.         }
  307.     }
  308.     
  309.     /**
  310.      * Get a role instance property.
  311.      * 
  312.      * @command-name GetRoleInstanceProperty
  313.      * @command-description Get a specified role instance property for a specified role instance.
  314.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  315.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  316.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  317.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  318.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  319.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  320.      * @command-parameter-for $instanceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --InstanceName Required. The role instance name to retrieve properties for.
  321.      * @command-parameter-for $propertyName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --PropertyName Required. The role instance property to retrieve.
  322.      * @command-example Get role instance property "Status" for role "role_0" for production-slot deployment of the hosted service "phptest":
  323.      * @command-example GetRoleInstances -sid="<your_subscription_id>" -cert="mycert.pem"
  324.      * @command-example --Name="servicename" --BySlot="production" --InstanceName="role_0" --PropertyName="Status"
  325.      * @command-example Possible values for PropertyName are "Role Name", "Status", "Upgrade Domain", "Fault Domain", "Size"
  326.      */
  327.     public function getRoleInstanceProperty($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$instanceName$propertyName)
  328.     {
  329.         if (!in_array($propertyNamearray("Role Name""Status""Upgrade Domain""Fault Domain""Size"))) {
  330.             printf("%s is not a valid property name. Valid property names are 'Role Name', 'Status', 'Upgrade Domain', 'Fault Domain', 'Size'"$propertyName);
  331.             return;
  332.         }
  333.         
  334.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  335.         
  336.         $result null;
  337.         
  338.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  339.             $deploymentSlot strtolower($deploymentSlot);
  340.             
  341.             $result $client->getRoleInstancesByDeploymentSlot($serviceName$deploymentSlot);
  342.         else {
  343.             $result $client->getRoleInstancesByDeploymentId($serviceName$deploymentName);
  344.         }
  345.         
  346.         $instance_found false;
  347.         
  348.         foreach($result as $instance{
  349.             if($instance['instancename'== $instanceName{
  350.                 switch($propertyName{
  351.                     case "Role Name":
  352.                         printf($instance['rolename']);
  353.                         break;
  354.                     case "Status":
  355.                         printf($instance['instancestatus']);
  356.                         break;
  357.                     case "Upgrade Domain":
  358.                         printf($instance['instanceupgradedomain']);
  359.                         break;
  360.                     case "Fault Domain":
  361.                         printf($instance['instancefaultdomain']);
  362.                         break;
  363.                     case "Size":
  364.                         printf($instance['instancesize']);
  365.                         break;
  366.                 }
  367.                 
  368.                 $instance_found true;
  369.                 continue;
  370.             }
  371.         }
  372.         
  373.         if(!$instance_found{
  374.             printf("No instance with name %s was found."$instanceName);
  375.         }
  376.     }
  377.     
  378.     /**
  379.      * Swap deployment slots (perform VIP swap).
  380.      * 
  381.      * @command-name Swap
  382.      * @command-description Swap deployment slots (perform VIP swap).
  383.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  384.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  385.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  386.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  387.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  388.      * @command-example Swap deployment slots:
  389.      * @command-example Swap -sid="<your_subscription_id>" -cert="mycert.pem" --Name="servicename"
  390.      */
  391.     public function swapCommand($subscriptionId$certificate$certificatePassphrase$serviceName$waitForOperation false)
  392.     {
  393.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  394.         
  395.         $productionDeploymentName null;
  396.         try $productionDeploymentName $client->getDeploymentBySlot($serviceName'production')->Namecatch (Exception $ex{}
  397.         
  398.         $stagingDeploymentName null;
  399.         try $stagingDeploymentName $client->getDeploymentBySlot($serviceName'staging')->Namecatch (Exception $ex{}
  400.         
  401.         if (is_null($productionDeploymentName)) {
  402.             $productionDeploymentName $stagingDeploymentName;
  403.         }
  404.         if (is_null($stagingDeploymentName)) {
  405.             throw new Microsoft_Console_Exception('Swapping deployment slots is only possible when both slots have an active deployment or when production slot is empty.');
  406.         }
  407.  
  408.         $client->swapDeployment($serviceName$productionDeploymentName$stagingDeploymentName);
  409.         
  410.         if ($waitForOperation{
  411.             $client->waitForOperation();
  412.         }
  413.         echo $client->getLastRequestId();
  414.     }
  415.     
  416.     /**
  417.      * Deletes a deployment.
  418.      * 
  419.      * @command-name Delete
  420.      * @command-description Deletes a deployment.
  421.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  422.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  423.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  424.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  425.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  426.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  427.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  428.      * @command-example Delete a deployment:
  429.      * @command-example Delete -sid="<your_subscription_id>" -cert="mycert.pem" --Name="hostedservicename" --DeploymentName="deploymentname"
  430.      */
  431.     public function deleteCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$waitForOperation false)
  432.     {
  433.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  434.  
  435.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  436.             $deploymentSlot strtolower($deploymentSlot);
  437.             
  438.             $client->deleteDeploymentBySlot($serviceName$deploymentSlot);
  439.         else {
  440.             $client->deleteDeploymentByDeploymentId($serviceName$deploymentName);
  441.         }
  442.         
  443.         if ($waitForOperation{
  444.             $client->waitForOperation();
  445.         }
  446.         echo $client->getLastRequestId();
  447.     }
  448.     
  449.     /**
  450.      * Updates a deployment's configuration.
  451.      * 
  452.      * @command-name UpdateConfig
  453.      * @command-description Updates a deployment's configuration.
  454.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  455.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  456.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  457.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  458.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  459.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  460.      * @command-parameter-for $serviceConfigurationLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file.
  461.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  462.      * @command-example Update configuration:
  463.      * @command-example UpdateConfig -sid="<your_subscription_id>" -cert="mycert.pem"
  464.      * @command-example --Name="hostedservicename" --ByName="deploymentname"
  465.      * @command-example --ServiceConfigLocation=".\ServiceConfiguration.cscfg"
  466.      */
  467.     public function updateConfigurationCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$serviceConfigurationLocation$waitForOperation false)
  468.     {
  469.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  470.  
  471.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  472.             $deploymentSlot strtolower($deploymentSlot);
  473.             
  474.             $client->configureDeploymentBySlot($serviceName$deploymentSlot$serviceConfigurationLocation);
  475.         else {
  476.             $client->configureDeploymentByDeploymentId($serviceName$deploymentName$serviceConfigurationLocation);
  477.         }
  478.         
  479.         if ($waitForOperation{
  480.             $client->waitForOperation();
  481.         }
  482.         echo $client->getLastRequestId();
  483.     }
  484.     
  485.     /**
  486.      * Updates a deployment's status.
  487.      * 
  488.      * @command-name UpdateStatus
  489.      * @command-description Updates a deployment's status.
  490.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  491.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  492.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  493.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  494.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  495.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  496.      * @command-parameter-for $newStatus Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Status Required. New status (Suspended|Running)
  497.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  498.      * @command-example Suspend a deployment:
  499.      * @command-example UpdateStatus -sid="<your_subscription_id>" -cert="mycert.pem"
  500.      * @command-example --Name="hostedservicename" --ByName="deploymentname"
  501.      * @command-example --Status="Suspended"
  502.      */
  503.     public function updateStatusCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$newStatus$waitForOperation false)
  504.     {
  505.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  506.  
  507.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  508.             $deploymentSlot strtolower($deploymentSlot);
  509.             
  510.             $client->updateDeploymentStatusBySlot($serviceName$deploymentSlot$newStatus);
  511.         else {
  512.             $client->updateDeploymentStatusByDeploymentId($serviceName$deploymentName$newStatus);
  513.         }
  514.         
  515.         if ($waitForOperation{
  516.             $client->waitForOperation();
  517.         }
  518.         echo $client->getLastRequestId();
  519.     }
  520.     
  521.     /**
  522.      * Updates the number of instances.
  523.      * 
  524.      * @command-name EditInstanceNumber
  525.      * @command-description Updates the number of instances.
  526.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  527.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  528.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  529.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  530.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  531.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  532.      * @command-parameter-for $roleName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RoleName|-r Required. Role name to update the number of instances for.
  533.      * @command-parameter-for $newInstanceNumber Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --NewInstanceNumber|-i Required. New number of instances.
  534.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  535.      * @command-example Suspend a deployment:
  536.      * @command-example EditInstanceNumber -sid="<your_subscription_id>" -cert="mycert.pem"
  537.      * @command-example --Name="hostedservicename" --ByName="deploymentname"
  538.      * @command-example --NewInstanceNumber="4"
  539.      */
  540.     public function editInstanceNumberCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$roleName$newInstanceNumber 1$waitForOperation false)
  541.     {
  542.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  543.  
  544.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  545.             $deploymentSlot strtolower($deploymentSlot);
  546.             
  547.             $client->setInstanceCountBySlot($serviceName$deploymentSlot$roleName$newInstanceNumber);
  548.         else {
  549.             $client->setInstanceCountByDeploymentId($serviceName$deploymentName$roleName$newInstanceNumber);
  550.         }
  551.         
  552.         if ($waitForOperation{
  553.             $client->waitForOperation();
  554.         }
  555.         echo $client->getLastRequestId();
  556.     }
  557.     
  558.     /**
  559.      * Reboots a role instance.
  560.      * 
  561.      * @command-name RebootInstance
  562.      * @command-description Reboots a role instance.
  563.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  564.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  565.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  566.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  567.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  568.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  569.      * @command-parameter-for $instanceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RoleInstanceName Required. The name of the role instance to work with.
  570.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  571.      * @command-example Reboot a role instance:
  572.      * @command-example RebootInstance -sid="<your_subscription_id>" -cert="mycert.pem"
  573.      * @command-example --Name="hostedservicename" --ByName="deploymentname"
  574.      * @command-example --RoleInstanceName="PhpOnAzure.Web_IN_0"
  575.      */
  576.     public function rebootInstanceCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$instanceName$waitForOperation false)
  577.     {
  578.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  579.  
  580.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  581.             $deploymentSlot strtolower($deploymentSlot);
  582.             
  583.             $client->rebootRoleInstanceBySlot($serviceName$deploymentSlot$instanceName);
  584.         else {
  585.             $client->rebootRoleInstanceByDeploymentId($serviceName$deploymentName$instanceName);
  586.         }
  587.         
  588.         if ($waitForOperation{
  589.             $client->waitForOperation();
  590.         }
  591.         echo $client->getLastRequestId();
  592.     }
  593.     
  594.     /**
  595.      * Reimages a role instance.
  596.      * 
  597.      * @command-name ReimageInstance
  598.      * @command-description Reimages a role instance.
  599.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  600.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  601.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  602.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  603.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  604.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  605.      * @command-parameter-for $instanceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RoleInstanceName Required. The name of the role instance to work with.
  606.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  607.      * @command-example Reimage a role instance:
  608.      * @command-example ReimageInstance -sid="<your_subscription_id>" -cert="mycert.pem"
  609.      * @command-example --Name="hostedservicename" --ByName="deploymentname"
  610.      * @command-example --RoleInstanceName="PhpOnAzure.Web_IN_0"
  611.      */
  612.     public function reimageInstanceCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$instanceName$waitForOperation false)
  613.     {
  614.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  615.  
  616.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  617.             $deploymentSlot strtolower($deploymentSlot);
  618.             
  619.             $client->reimageRoleInstanceBySlot($serviceName$deploymentSlot$instanceName);
  620.         else {
  621.             $client->reimageRoleInstanceByDeploymentId($serviceName$deploymentName$instanceName);
  622.         }
  623.         
  624.         if ($waitForOperation{
  625.             $client->waitForOperation();
  626.         }
  627.         echo $client->getLastRequestId();
  628.     }
  629.     
  630.     /**
  631.      * Upgrades a deployment from a remote package file and service configuration.
  632.      * 
  633.      * @command-name UpgradeFromStorage
  634.      * @command-description Upgrades a deployment from a remote package file and service configuration.
  635.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  636.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  637.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  638.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Name Required. The hosted service DNS name to operate on.
  639.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  640.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  641.      * @command-parameter-for $label Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment.
  642.      * @command-parameter-for $packageUrl Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --PackageUrl Required. The remote location of the .cspkg file.
  643.      * @command-parameter-for $serviceConfigurationLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file.
  644.      * @command-parameter-for $mode Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Mode Required. Set to auto|manual.
  645.      * @command-parameter-for $roleName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RoleName Optional. Role name to upgrade.
  646.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  647.      */
  648.     public function upgradeFromStorageCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$label$packageUrl$serviceConfigurationLocation$mode 'auto'$roleName null$waitForOperation false)
  649.     {        
  650.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  651.  
  652.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  653.             $deploymentSlot strtolower($deploymentSlot);
  654.             
  655.             $client->upgradeDeploymentBySlot($serviceName$deploymentSlot$label$packageUrl$serviceConfigurationLocation$mode$roleName);
  656.         else {
  657.             $client->upgradeDeploymentByDeploymentId($serviceName$deploymentName$label$packageUrl$serviceConfigurationLocation$mode$roleName);
  658.         }
  659.         
  660.         if ($waitForOperation{
  661.             $client->waitForOperation();
  662.         }
  663.         echo $client->getLastRequestId();
  664.     }
  665.     
  666.     /**
  667.      * Upgrades a deployment from a local package file and service configuration.
  668.      * 
  669.      * @command-name UpgradeFromLocal
  670.      * @command-description Upgrades a deployment from a local package file and service configuration.
  671.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  672.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  673.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  674.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Name Required. The hosted service DNS name to operate on.
  675.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  676.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  677.      * @command-parameter-for $label Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Label Required. The label for the deployment.
  678.      * @command-parameter-for $packageLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --PackageLocation Required. The location of the .cspkg file.
  679.      * @command-parameter-for $serviceConfigurationLocation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ServiceConfigLocation Required. The location of the .cspkg file.
  680.      * @command-parameter-for $storageAccount Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --StorageAccount Required. Storage account to use when creating the deployment.
  681.      * @command-parameter-for $mode Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Mode Required. Set to auto|manual.
  682.      * @command-parameter-for $roleName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RoleName Optional. Role name to upgrade.
  683.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  684.      */
  685.     public function upgradeFromLocalCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$label$packageLocation$serviceConfigurationLocation$storageAccount$mode 'auto'$roleName null$waitForOperation false)
  686.     {
  687.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  688.         
  689.         $blobClient $client->createBlobClientForService($storageAccount);
  690.         $blobClient->createContainerIfNotExists('phpazuredeployments');
  691.         $blobClient->putBlob('phpazuredeployments'basename($packageLocation)$packageLocation);
  692.         $package $blobClient->getBlobInstance('phpazuredeployments'basename($packageLocation));
  693.         
  694.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  695.             $deploymentSlot strtolower($deploymentSlot);
  696.             
  697.             $client->upgradeDeploymentBySlot($serviceName$deploymentSlot$label$package->Url$serviceConfigurationLocation$mode$roleName);
  698.         else {
  699.             $client->upgradeDeploymentByDeploymentId($serviceName$deploymentName$label$package->Url$serviceConfigurationLocation$mode$roleName);
  700.         }
  701.         
  702.         $client->waitForOperation();
  703.         $blobClient->deleteBlob('phpazuredeployments'basename($packageLocation));
  704.         
  705.         if ($waitForOperation{
  706.             $client->waitForOperation();
  707.         }
  708.         echo $client->getLastRequestId();
  709.     }
  710.     
  711.     /**
  712.      * Walks upgrade domains.
  713.      * 
  714.      * @command-name WalkUpgradeDomains
  715.      * @command-description Walks upgrade domains.
  716.      * @command-parameter-for $subscriptionId Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on.
  717.      * @command-parameter-for $certificate Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate.
  718.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Passphrase|-p The certificate passphrase. If not specified, a prompt will be displayed.
  719.      * @command-parameter-for $serviceName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The hosted service DNS name to operate on.
  720.      * @command-parameter-for $deploymentSlot Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --BySlot Required if deployment name is omitted. The slot to retrieve property information for.
  721.      * @command-parameter-for $deploymentName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --ByName Required if deployment slot is omitted. The deployment name to retrieve property information for.
  722.      * @command-parameter-for $upgradeDomain Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --UpgradeDomain Required. The upgrade domain index.
  723.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  724.      */
  725.     public function walkUpgradeDomainsCommand($subscriptionId$certificate$certificatePassphrase$serviceName$deploymentSlot$deploymentName$upgradeDomain$waitForOperation false)
  726.     {
  727.         $client new Microsoft_WindowsAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  728.         
  729.         if (!is_null($deploymentSlot&& $deploymentSlot != ''{
  730.             $deploymentSlot strtolower($deploymentSlot);
  731.             
  732.             $client->walkUpgradeDomainBySlot($serviceName$deploymentSlot$upgradeDomain);
  733.         else {
  734.             $client->walkUpgradeDomainByDeploymentId($serviceName$deploymentName$upgradeDomain);
  735.         }
  736.         
  737.         if ($waitForOperation{
  738.             $client->waitForOperation();
  739.         }
  740.         echo $client->getLastRequestId();
  741.     }
  742. }
  743.  

Documentation generated on Sat, 03 Dec 2011 13:59:21 +0100 by phpDocumentor 1.4.3