File indexing completed on 2024-12-29 05:28:03
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Service_Console 0017 * @subpackage Exception 0018 * @version $Id$ 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 */ 0022 0023 /** 0024 * @see Zend_Service_Console_Command 0025 */ 0026 // require_once 'Zend/Service/Console/Command.php'; 0027 0028 /** 0029 * @see Zend_Service_WindowsAzure_Management_Client 0030 */ 0031 // require_once 'Zend/Service/WindowsAzure/Management/Client.php'; 0032 0033 /** 0034 * Asynchronous Operation commands 0035 * 0036 * @category Zend 0037 * @package Zend_Service_WindowsAzure_CommandLine 0038 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0039 * @license http://framework.zend.com/license/new-bsd New BSD License 0040 * 0041 * @command-handler getasynchronousoperation 0042 * @command-handler-description Windows Azure Asynchronous Operation commands 0043 * @command-handler-header Windows Azure SDK for PHP 0044 * @command-handler-header Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com) 0045 * @command-handler-footer Note: Parameters that are common across all commands can be stored 0046 * @command-handler-footer in two dedicated environment variables. 0047 * @command-handler-footer - SubscriptionId: The Windows Azure Subscription Id to operate on. 0048 * @command-handler-footer - Certificate The Windows Azure .cer Management Certificate. 0049 * @command-handler-footer 0050 * @command-handler-footer All commands support the --ConfigurationFile or -F parameter. 0051 * @command-handler-footer The parameter file is a simple INI file carrying one parameter 0052 * @command-handler-footer value per line. It accepts the same parameters as one can 0053 * @command-handler-footer use from the command line command. 0054 */ 0055 class Zend_Service_WindowsAzure_CommandLine_GetAsynchronousOperation 0056 extends Zend_Service_Console_Command 0057 { 0058 /** 0059 * Get information for a specific asynchronous request. 0060 * 0061 * @command-name GetInfo 0062 * @command-description Get information for a specific asynchronous request. 0063 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on. 0064 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate. 0065 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed. 0066 * @command-parameter-for $requestId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --RequestId|-r Required. The value returned by a call that starts an asynchronous operation to monitor. 0067 * @command-example Get information for a specific asynchronous operation: 0068 * @command-example GetInfo -sid:"<your_subscription_id>" -cert:"mycert.pem" -r:"dab87a4b70e94a36805f5af2d20fc593" 0069 */ 0070 public function getInfoCommand($subscriptionId, $certificate, $certificatePassphrase, $requestId) 0071 { 0072 $client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase); 0073 $result = $client->getOperationStatus($requestId); 0074 0075 $this->_displayObjectInformation($result, array('ID', 'Status', 'ErrorMessage')); 0076 } 0077 0078 /** 0079 * Wait for a specific asynchronous request to complete. 0080 * 0081 * @command-name WaitFor 0082 * @command-description Wait for a specific asynchronous request to complete. 0083 * @command-parameter-for $subscriptionId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --SubscriptionId|-sid Required. This is the Windows Azure Subscription Id to operate on. 0084 * @command-parameter-for $certificate Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Env --Certificate|-cert Required. This is the .pem certificate that user has uploaded to Windows Azure subscription as Management Certificate. 0085 * @command-parameter-for $certificatePassphrase Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile|Zend_Service_Console_Command_ParameterSource_Prompt --Passphrase|-p Required. The certificate passphrase. If not specified, a prompt will be displayed. 0086 * @command-parameter-for $requestId Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --RequestId|-r Required. The value returned by a call that starts an asynchronous operation to monitor. 0087 * @command-parameter-for $interval Zend_Service_Console_Command_ParameterSource_Argv|Zend_Service_Console_Command_ParameterSource_ConfigFile --Interval|-i Optional. The interval between two status checks (in milliseconds). 0088 * @command-example Wait for a specific asynchronous operation: 0089 * @command-example WaitFor -sid:"<your_subscription_id>" -cert:"mycert.pem" -r:"dab87a4b70e94a36805f5af2d20fc593" 0090 */ 0091 public function waitForCommand($subscriptionId, $certificate, $certificatePassphrase, $requestId, $interval = 250) 0092 { 0093 $client = new Zend_Service_WindowsAzure_Management_Client($subscriptionId, $certificate, $certificatePassphrase); 0094 $client->waitForOperation($requestId, $interval); 0095 } 0096 } 0097 0098 Zend_Service_Console_Command::bootstrap($_SERVER['argv']);