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

Source for file SqlAzure.php

Documentation is available at SqlAzure.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.  * Service commands
  43.  * 
  44.  * @category   Microsoft
  45.  * @package    Microsoft_SqlAzure_CommandLine
  46.  * @copyright  Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
  47.  * @license    http://phpazure.codeplex.com/license
  48.  * 
  49.  * @command-handler sqlazure
  50.  * @command-handler-description Sql Azure Server 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.      * List servers for a specified subscription.
  67.      * 
  68.      * @command-name List
  69.      * @command-description List servers for a specified subscription.
  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|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  73.      * @command-example List servers for a specified subscription:
  74.      * @command-example List -sid="<your_subscription_id>" -cert="mycert.pem"
  75.      */
  76.     public function listCommand($subscriptionId$certificate$certificatePassphrase)
  77.     {
  78.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  79.         $result $client->listServers();
  80.  
  81.         if (count($result== 0{
  82.             echo 'No data to display.';
  83.         }
  84.         foreach ($result as $object{
  85.             $this->_displayObjectInformation($objectarray('Name''AdministratorLogin'));
  86.         }
  87.     }
  88.     
  89.     /**
  90.      * Get server properties.
  91.      * 
  92.      * @command-name GetProperties
  93.      * @command-description Get server properties.
  94.      * @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.
  95.      * @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.
  96.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  97.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  98.      * @command-example Get server properties for server "ie2l1ph28":
  99.      * @command-example GetProperties -sid="<your_subscription_id>" -cert="mycert.pem"
  100.      * @command-example --Name="ie2l1ph28"
  101.      */
  102.     public function getPropertiesCommand($subscriptionId$certificate$certificatePassphrase$serverName)
  103.     {
  104.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  105.         $result $client->listServers();
  106.  
  107.         $server null;
  108.         foreach ($result as $serverInstance{
  109.             if ($serverInstance->Name == $serverName{
  110.                 $server $serverInstance;
  111.                 break;
  112.             }
  113.         }
  114.  
  115.         $this->_displayObjectInformation($serverarray('Name''DnsName''AdministratorLogin''Location'));
  116.     }
  117.     
  118.     /**
  119.      * Get server property.
  120.      * 
  121.      * @command-name GetProperty
  122.      * @command-description Get server property.
  123.      * @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.
  124.      * @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.
  125.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  126.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  127.      * @command-parameter-for $property Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Property|-prop Required. The property to retrieve for the server.
  128.      * @command-example Get server property "Name" for service "ie2l1ph28":
  129.      * @command-example GetProperty -sid="<your_subscription_id>" -cert="mycert.pem"
  130.      * @command-example --Name="ie2l1ph28" --Property=Name
  131.      */
  132.     public function getPropertyCommand($subscriptionId$certificate$certificatePassphrase$serverName$property)
  133.     {
  134.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  135.         $result $client->listServers();
  136.  
  137.         $server null;
  138.         foreach ($result as $serverInstance{
  139.             if ($serverInstance->Name == $serverName{
  140.                 $server $serverInstance;
  141.                 break;
  142.             }
  143.         }
  144.         
  145.         printf("%s\r\n"$server->$property);
  146.     }
  147.     
  148.     /**
  149.      * Create server.
  150.      * 
  151.      * @command-name Create
  152.      * @command-description Create server.
  153.      * @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.
  154.      * @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.
  155.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  156.      * @command-parameter-for $administratorLogin Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Login|-l Required. The administrator login name for the server.
  157.      * @command-parameter-for $administratorPassword Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Password|-pass Required. The administrator password for the server.
  158.      * @command-parameter-for $location Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Location Required. The location where the server will be created.
  159.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  160.      * @command-example Create server in West Europe
  161.      * @command-example Create -p="phpazure" --Login="sqladm" --Password="PHP@zure11" --Location="West Europe"
  162.      */
  163.     public function createCommand($subscriptionId$certificate$certificatePassphrase$administratorLogin$administratorPassword$location$waitForOperation false)
  164.     {
  165.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  166.         $server $client->createServer($administratorLogin$administratorPassword$location);
  167.         echo $server->Name;
  168.     }
  169.     
  170.     /**
  171.      * Drop server.
  172.      * 
  173.      * @command-name Drop
  174.      * @command-description Drop server.
  175.      * @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.
  176.      * @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.
  177.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  178.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  179.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  180.      * @command-example Drop server "ie2l1ph28":
  181.      * @command-example Drop -p="phpazure" --Name="ie2l1ph28"
  182.      */
  183.     public function dropCommand($subscriptionId$certificate$certificatePassphrase$serverName$waitForOperation false)
  184.     {
  185.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  186.         $server $client->dropServer($serverName);
  187.     }
  188.     
  189.     /**
  190.      * Update administrator password for server.
  191.      * 
  192.      * @command-name UpdatePassword
  193.      * @command-description Update administrator password for server.
  194.      * @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.
  195.      * @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.
  196.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  197.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  198.      * @command-parameter-for $administratorPassword Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Password|-pass Required. The administrator password for the server.
  199.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  200.      * @command-example Update administrator password for server "ie2l1ph28":
  201.      * @command-example UpdatePassword -p="phpazure" --Name="ie2l1ph28" --Password="PHP@zure11"
  202.      */
  203.     public function updatePasswordCommand($subscriptionId$certificate$certificatePassphrase$serverName$administratorPassword$waitForOperation false)
  204.     {
  205.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  206.         $server $client->setAdministratorPassword($serverName$administratorPassword);
  207.     }
  208.     
  209.     /**
  210.      * Create firewall rule for server.
  211.      * 
  212.      * @command-name CreateFirewallRule
  213.      * @command-description Create firewall rule for server.
  214.      * @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.
  215.      * @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.
  216.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  217.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  218.      * @command-parameter-for $ruleName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RuleName|-r Required. Firewall rule name.
  219.      * @command-parameter-for $startIpAddress Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --StartIp|-start Required. Start IP address.
  220.      * @command-parameter-for $endIpAddress Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --EndIp|-end Required. End IP address.
  221.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  222.      * @command-example Create firewall rule for server "ie2l1ph28":
  223.      * @command-example CreateFirewallRule -p="phpazure" --Name="ie2l1ph28" -r="Rule1" -start="1.2.3.4" -end="1.2.3.4"
  224.      */
  225.     public function createFirewallRuleCommand($subscriptionId$certificate$certificatePassphrase$serverName$ruleName$startIpAddress$endIpAddress$waitForOperation false)
  226.     {
  227.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  228.         $rule $client->createFirewallRule($serverName$ruleName$startIpAddress$endIpAddress);
  229.     }
  230.     
  231.     /**
  232.      * Allow access from Windows Azure to SQL Azure.
  233.      * 
  234.      * @command-name AllowWindowsAzure
  235.      * @command-description Allow access from Windows Azure to SQL Azure.
  236.      * @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.
  237.      * @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.
  238.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  239.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  240.      * @command-parameter-for $allow Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --Allow|-a Required. Allow access from Windows Azure true/false.
  241.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  242.      * @command-example Allow access from Windows Azure to SQL Azure for server "ie2l1ph28":
  243.      * @command-example AllowWindowsAzure -p="phpazure" --Name="ie2l1ph28" -Allow:true
  244.      */
  245.     public function allowWindowsAzureCommand($subscriptionId$certificate$certificatePassphrase$serverName$allow false$waitForOperation false)
  246.     {
  247.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  248.         $rule $client->createFirewallRuleForMicrosoftServices($serverName$allow);
  249.     }
  250.     
  251.     /**
  252.      * Delete firewall rule for server.
  253.      * 
  254.      * @command-name DeleteFirewallRule
  255.      * @command-description Delete firewall rule for server.
  256.      * @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.
  257.      * @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.
  258.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  259.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  260.      * @command-parameter-for $ruleName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --RuleName|-r Required. Firewall rule name.
  261.      * @command-parameter-for $waitForOperation Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --WaitFor|-w Optional. Wait for the operation to complete?
  262.      * @command-example Delete firewall rule for server "ie2l1ph28":
  263.      * @command-example DeleteFirewallRule -p="phpazure" --Name="ie2l1ph28" -r="Rule1"
  264.      */
  265.     public function deleteFirewallRuleCommand($subscriptionId$certificate$certificatePassphrase$serverName$ruleName$waitForOperation false)
  266.     {
  267.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  268.         $rule $client->deleteFirewallRule($serverName$ruleName);
  269.     }
  270.     
  271.     /**
  272.      * List firewall rules for a specified server.
  273.      * 
  274.      * @command-name ListFirewallRules
  275.      * @command-description List firewall rules for a specified server.
  276.      * @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.
  277.      * @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.
  278.      * @command-parameter-for $certificatePassphrase Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed.
  279.      * @command-parameter-for $serverName Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_StdIn --Name Required. The server name to operate on.
  280.      * @command-example List firewall rules for server "ie2l1ph28":
  281.      * @command-example ListFirewallRules -sid="<your_subscription_id>" --Name="ie2l1ph28"
  282.      */
  283.     public function listFirewallRuleCommand($subscriptionId$certificate$certificatePassphrase$serverName)
  284.     {
  285.         $client new Microsoft_SqlAzure_Management_Client($subscriptionId$certificate$certificatePassphrase);
  286.         $result $client->listFirewallRules($serverName);
  287.  
  288.         if (count($result== 0{
  289.             echo 'No data to display.';
  290.         }
  291.         foreach ($result as $object{
  292.             $this->_displayObjectInformation($objectarray('Name''StartIpAddress''EndIpAddress'));
  293.         }
  294.     }
  295. }
  296.  

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