Browse Source

ZF-6717: Updates to the documentation and docblock fixes in the code.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16389 44c647ce-9c0f-0410-b52a-842ac1e357ba
sidhighwind 16 years ago
parent
commit
e0f1fce010

+ 3 - 0
documentation/manual/en/manual.xml.in

@@ -429,6 +429,9 @@
         <xi:include href="module_specs/Zend_Service_Amazon.xml" />
         <xi:include href="module_specs/Zend_Service_Amazon_Ec2.xml" />
         <xi:include href="module_specs/Zend_Service_Amazon_Ec2-Instance.xml" />
+        <xi:include href="module_specs/Zend_Service_Amazon_Ec2-WindowsInstance.xml" />
+        <xi:include href="module_specs/Zend_Service_Amazon_Ec2-ReservedInstance.xml" />
+        <xi:include href="module_specs/Zend_Service_Amazon_Ec2-CloudWatch.xml" />
         <xi:include href="module_specs/Zend_Service_Amazon_Ec2-Image.xml" />
         <xi:include href="module_specs/Zend_Service_Amazon_Ec2-Ebs.xml" />
         <xi:include href="module_specs/Zend_Service_Amazon_Ec2-Elasticip.xml" />

+ 106 - 0
documentation/manual/en/module_specs/Zend_Service_Amazon_Ec2-CloudWatch.xml

@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.amazon.ec2.cloudwatch">
+	<title>Zend_Service_Amazon_Ec2: CloudWatch Monitoring</title>
+	<para>
+		Amazon CloudWatch is an easy-to-use web service that provides
+		comprehensive monitoring for Amazon Elastic Compute Cloud (Amazon
+		EC2) and Elastic Load Balancing. For more details information 
+		check cout the <ulink ulr="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/index.html?SvcIntro.html">
+			Amazon CloudWatch Developers Guide</ulink>
+	</para>
+	
+	<sect2 id="zend.service.amazon.ec2.cloudwatch.usage">
+		<title>CloudWatch Usage</title>
+
+        <example id="zend.service.amazon.ec2.cloudwatch.usage.list">
+            <title>Listing Aviable Metrics</title>
+            <para>
+                <code>listMetrics</code> returns a list of up to 500 valid metrics for
+				which there is recorded data available to a you and a NextToken string
+				that can be used to query for the next set of results.
+            </para>
+
+            <programlisting language="php"><![CDATA[
+$ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
+$return = $ec2_ebs->listMetrics();
+]]></programlisting>
+        </example>
+		
+		<example id="zend.service.amazon.ec2.cloudwatch.usage.getmetricstatistics">
+            <title>Return Statistics for a given metric</title>
+            <para>
+                <code>getMetricStatistics</code> Returns data for one or more
+				statistics of given a metric.
+            </para>
+			<note>
+				The maximum number of datapoints that the Amazon CloudWatch service will
+			    return in a single GetMetricStatistics request is 1,440. If a request is
+			    made that would generate more datapoints than this amount, Amazon CloudWatch
+			    will return an error. You can alter your request by narrowing the time range
+			    (StartTime, EndTime) or increasing the Period in your single request. You may
+			    also get all of the data at the granularity you originally asked for by making
+			    multiple requests with adjacent time ranges.
+			</note>
+			<para>
+				<code>getMetricStatistics</code> only requires two parameters but it also has four
+				additional parameters that are optional.
+				<itemizedlist>
+					<listitem>
+						<emphasis>Required:</emphasis>
+					</listitem>
+					<listitem>
+						<emphasis>MeasureName</emphasis> The measure name that corresponds to
+                        the measure for the gathered metric. Valid EC2 Values are
+                        CPUUtilization, NetworkIn, NetworkOut, DiskWriteOps
+                        DiskReadBytes, DiskReadOps, DiskWriteBytes. Valid Elastic
+                        Load Balancing Metrics are Latency, RequestCount, HealthyHostCount
+                        UnHealthyHostCount.  <ulink url="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/arch-AmazonCloudWatch-metricscollected.html">
+                        	For more information click here</ulink>
+					</listitem>
+					<listitem>
+						<emphasis>Statistics</emphasis> The statistics to be returned for the given metric. Valid
+                        values are Average, Maximum, Minimum, Samples, Sum.  You can specify
+                        this as a string or as an array of values.  If you don't specify one
+                        it will default to Average instead of failing out.  If you specify an incorrect
+                        option it will just skip it. <ulink url="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/arch-Amazon-CloudWatch-statistics.html">
+                        	For more information click here</ulink>
+					</listitem>
+					<listitem>
+						<emphasis>Optional:</emphasis>
+					</listitem>
+					<listitem>
+						<emphasis>Dimensions</emphasis> Amazon CloudWatch allows you to specify one Dimension to further filter
+                        metric data on. If you don't specify a dimension, the service returns the aggregate
+                        of all the measures with the given measure name and time range.
+					</listitem>
+					<listitem>
+						<emphasis>Unit</emphasis> The standard unit of Measurement for a given Measure. Valid Values: Seconds,
+                        Percent, Bytes, Bits, Count, Bytes/Second, Bits/Second, Count/Second, and None
+                        Constraints: When using count/second as the unit, you should use Sum as the statistic
+                        instead of Average. Otherwise, the sample returns as equal to the number of requests
+                        instead of the number of 60-second intervals. This will cause the Average to
+                        always equals one when the unit is count/second.
+					</listitem>
+					<listitem>
+						<emphasis>StartTime</emphasis> The timestamp of the first datapoint to return, inclusive. For example,
+	                    2008-02-26T19:00:00+00:00. We round your value down to the nearest minute.
+	                    You can set your start time for more than two weeks in the past. However,
+	                    you will only get data for the past two weeks. (in ISO 8601 format)
+	                    Constraints: Must be before EndTime
+					</listitem>
+					<listitem>
+						<emphasis>EndTime</emphasis> The timestamp to use for determining the last datapoint to return. This is
+                        the last datapoint to fetch, exclusive. For example, 2008-02-26T20:00:00+00:00.
+                        (in ISO 8601 format)
+					</listitem>
+				</itemizedlist>
+			</para>
+
+            <programlisting language="php"><![CDATA[
+$ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
+$return = $ec2_ebs->getMetricStatistics(array('MeasureName' => 'NetworkIn', 'Statistics' => array('Average')));
+]]></programlisting>
+        </example>
+	</sect2>
+</sect1>

+ 38 - 1
documentation/manual/en/module_specs/Zend_Service_Amazon_Ec2-Instance.xml

@@ -293,6 +293,13 @@
                             </para></entry>
                             <entry><para>No</para></entry>
                         </row>
+						<row>
+                            <entry><code>monitor</code></entry>
+                            <entry><para>
+                                 Turn on AWS CloudWatch Instance Monitoring
+                            </para></entry>
+                            <entry><para>No</para></entry>
+                        </row>
                     </tbody>
                 </tgroup>
             </table>
@@ -460,7 +467,37 @@ $return = $ec2_instance->consoleOutput('instanceId');
             <programlisting language="php"><![CDATA[
 $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                      'aws_secret_key');
-$return = $ec2_instance->terminate('productCode', 'instanceId');
+$return = $ec2_instance->confirmProduct('productCode', 'instanceId');
+]]></programlisting>
+
+        </example>
+		
+		<example id="zend.service.amazon.ec2.instance.utility.monitor">
+            <title>Turn on CloudWatch Monitoring on an Instance(s)</title>
+            <para>
+                <code>monitor</code> returns the list of instances and their
+				current state of the CloudWatch Monitoring.  If the instance
+				does not currently have Monitoring enabled it will be turned on.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->monitor('instanceId');
+]]></programlisting>
+
+        </example>
+		
+		<example id="zend.service.amazon.ec2.instance.utility.unmonitor">
+            <title>Turn off CloudWatch Monitoring on an Instance(s)</title>
+            <para>
+                <code>monitor</code> returns the list of instances and their
+				current state of the CloudWatch Monitoring.  If the instance
+				currently has Monitoring enabled it will be turned off.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->unmonitor('instanceId');
 ]]></programlisting>
 
         </example>

+ 119 - 0
documentation/manual/en/module_specs/Zend_Service_Amazon_Ec2-ReservedInstance.xml

@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.amazon.ec2.reserved.instance">
+    <title>Zend_Service_Amazon_Ec2: Reserved Instances</title>
+	
+	<para>
+		With Amazon EC2 Reserved Instances, you can make a low one-time payment for
+		each instance to reserve and receive a significant discount on the hourly
+		usage charge for that instance.
+	</para>
+	<para>
+		Amazon EC2 Reserved Instances are based on instance type and location
+		(region and Availability Zone) for a specified period of time (e.g.,
+		1 year or 3 years) and are only available for Linux/UNIX instances.
+	</para>
+	
+	<sect2 id="zend.service.amazon.ec2.reserved.instance.howitworks">
+		<title>How Reserved Instances are Applied</title>
+		<para>
+			Reserved Instances are applied to instances that meet the type/location 
+			criteria during the specified period. In this example, a user is running
+			the following instances:
+		</para>
+		<itemizedlist>
+            <listitem>
+            	(4) m1.small instances in Availability Zone us-east-1a
+			</listitem>
+			<listitem>
+            	(4) c1.medium instances in Availability Zone us-east-1b
+			</listitem>
+			<listitem>
+            	(2) c1.xlarge instances in Availability Zone us-east-1b
+			</listitem>
+		</itemizedlist>
+		<para>
+			The user then purchases the following Reserved Instances.
+		</para>
+		<itemizedlist>
+            <listitem>
+            	(2) m1.small instances in Availability Zone us-east-1a
+			</listitem>
+			<listitem>
+            	(2) c1.medium instances in Availability Zone us-east-1a
+			</listitem>
+			<listitem>
+            	(2) m1.xlarge instances in Availability Zone us-east-1a
+			</listitem>
+		</itemizedlist>
+		<para>
+			Amazon EC2 applies the two m1.small Reserved Instances to two of the instances
+			in Availability Zone us-east-1a. Amazon EC2 doesn't apply the two c1.medium
+			Reserved Instances because the c1.medium instances are in a different Availability
+			Zone and does not apply the m1.xlarge Reserved Instances because there are no
+			running m1.xlarge instances.
+		</para>
+	</sect2>
+	
+	<sect2 id="zend.service.amazon.ec2.reserved.instance.operations">
+		<title>Reserved Instances Usage</title>
+        <example id="zend.service.amazon.ec2.reserved.instance.operations.describe">
+            <title>Describes Reserved Instances that you purchased.</title>
+            <para>
+                <code>describeInstances</code> will return information about a reserved
+				instance or instances that you purchased.
+            </para>
+            <para>
+                <code>describeInstances</code> returns a multi-demential array that contains
+				reservedInstancesId, instanceType, availabilityZone, duration, fixedPrice,
+				usagePrice, productDescription, instanceCount and state.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Reserved('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->describeInstances('instanceId');
+]]></programlisting>
+
+        </example>
+
+        <example id="zend.service.amazon.ec2.reserved.instance.offerings.describe">
+            <title>Describe current Reserved Instance Offerings aviable</title>
+            <para>
+                <code>describeOfferings</code> Describes Reserved Instance offerings
+				that are available for purchase. With Amazon EC2 Reserved Instances,
+				you purchase the right to launch Amazon EC2 instances for a period of
+				time (without getting insufficient capacity errors) and pay a lower
+				usage rate for the actual time used.
+            </para>
+            <para>
+                <code>describeOfferings</code> returns a multi-demential array that contains
+				reservedInstancesId, instanceType, availabilityZone, duration, fixedPrice,
+				usagePrice and productDescription.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Reserved('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->describeOfferings();
+]]></programlisting>
+        </example>
+		
+		<example id="zend.service.amazon.ec2.reserved.instance.offerings.purchase">
+            <title>Turn off CloudWatch Monitoring on an Instance(s)</title>
+            <para>
+                <code>purchaseOffering</code> Purchases a Reserved Instance for use with your
+				account. With Amazon EC2 Reserved Instances, you purchase the right to launch
+				Amazon EC2 instances for a period of time (without getting insufficient capacity
+				errors) and pay a lower usage rate for the actual time used.
+            </para>
+			<para>
+				<code>purchaseOffering</code> returns the reservedInstanceId.
+			</para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Reserved('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->purchaseOffering('offeringId', 'instanceCount');
+]]></programlisting>
+
+        </example>
+    </sect2>
+</sect1>

+ 162 - 0
documentation/manual/en/module_specs/Zend_Service_Amazon_Ec2-WindowsInstance.xml

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.amazon.ec2.windows.instance">
+    <title>Zend_Service_Amazon_Ec2: Windows Instances</title>
+	
+	<para>
+		Using Amazon EC2 instances running Windows is similar to using instances
+		running Linux and UNIX. The following are the major differences between
+		instances that use Linux/UNIX and Windows:
+		
+		<itemizedlist>
+            <listitem>
+            	Remote Desktop—To access Windows instances, you use Remote
+				Desktop instead of SSH.
+        	</listitem>
+			<listitem>
+            	Administrative Password—To access Windows instances the first time,
+				you must obtain the administrative password using the ec2-get-password
+				command.
+        	</listitem>
+			<listitem>
+            	Simplified Bundling—To bundle a Windows instance, you use a single command
+				that shuts down the instance, saves it as an AMI, and restarts it.
+        	</listitem>
+		</itemizedlist>
+	</para>
+	
+	<para>
+		As part of this service, Amazon EC2 instances can now run Microsoft Windows Server 
+		2003. Our base Windows image provides you with most of the common functionality associated
+		with Windows. However, if you require more than two concurrent Windows users or need to
+		leverage applications that require LDAP, Kerberos, RADIUS, or other credential services,
+		you must use Windows with Authentication Services. For example, Microsoft Exchange Server
+		and Microsoft SharePoint Server require Windows with Authentication Services.
+	</para>
+	<note>
+		To get started using Windows instances, we recommend using the AWS Management Console.
+		There are differences in pricing between Windows and Windows with Authentication Services
+		instances. For information on pricing, go to the Amazon EC2 Product Page.
+	</note>
+	
+	<para>
+		Amazon EC2 currently provides the following Windows AMIs:
+		
+		<itemizedlist>
+            <listitem>
+            	Windows Authenticated (32-bit)
+        	</listitem>
+			<listitem>
+            	Windows Authenticated (64-bit)
+        	</listitem>
+			<listitem>
+            	Windows Anonymous (32-bit)
+        	</listitem>
+			<listitem>
+            	Windows Anonymous (64-bit)
+        	</listitem>
+		</itemizedlist>
+	</para>
+	
+	<para>
+		The Windows public AMIs that Amazon provides are unmodified
+		versions of Windows with the following two exceptions: we added
+		drivers to improve the networking and disk I/O performance and
+		we created the Amazon EC2 configuration service. The Amazon EC2
+		configuration service performs the following functions:
+		
+		<itemizedlist>
+            <listitem>
+            	Randomly sets the Administrator password on initial launch,
+				encrypts the password with the user’s SSH key, and reports
+				it to the console. This operation happens upon initial AMI
+				launch. If you change the password, AMIs that are created
+				from this instance use the new password.
+        	</listitem>
+			<listitem>
+            	Configures the computer name to the internal DNS name. To
+				determine the internal DNS name, see Using Instance Addressing.
+        	</listitem>
+			<listitem>
+            	 Sends the last three system and application errors from the
+				 event log to the console. This helps developers to identify
+				 problems that caused an instance to crash or network connectivity
+				 to be lost.
+        	</listitem>
+		</itemizedlist>
+	</para>
+
+	
+	<sect2 id="zend.service.amazon.ec2.windows.instance.operations">
+		<title>Windows Instances Usage</title>
+
+        <example id="zend.service.amazon.ec2.windows.instance.operations.bundle">
+            <title>Bundles an Amazon EC2 instance running Windows</title>
+			<para>
+				<code>bundle</code> has three require paramters and one optional
+				<itemizedlist>
+					<listitem>
+		            	 <code>instanceId</code> The instance you want to bundle
+		        	</listitem>
+					<listitem>
+		            	 <code>s3Bucket</code> Where you want the ami to live on S3
+		        	</listitem>
+					<listitem>
+		            	 <code>s3Prefix</code> The prefix you want to assign to the AMI on S3
+		        	</listitem>
+					<listitem>
+		            	 <code>uploadExpiration</code> The expiration of the upload policy. 
+						 Amazon recommends 12 hours or longer. This is based in nubmer of 
+						 minutes. Default is 1440 minutes (24 hours)
+		        	</listitem>
+				</itemizedlist>
+			</para>
+            <para>
+                <code>bundle</code> returns a multi-demential array that contains
+				instanceId, bundleId, state, startTime, updateTime, progress
+				s3Bucket and s3Prefix.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Windows('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->bundle('instanceId', 's3Bucket', 's3Prefix');
+]]></programlisting>
+
+        </example>
+
+        <example id="zend.service.amazon.ec2.windows.instance.operations.describe">
+            <title>Describes current bundling tasks</title>
+            <para>
+                <code>describeBundle</code> Describes current bundling tasks
+            </para>
+            <para>
+                <code>describeBundle</code> returns a multi-demential array that contains
+				instanceId, bundleId, state, startTime, updateTime, progress
+				s3Bucket and s3Prefix.
+            </para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Windows('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->describeBundle('bundleId');
+]]></programlisting>
+        </example>
+		
+		<example id="zend.service.amazon.ec2.windows.instance.operations.cancel">
+            <title>Cancels an Amazon EC2 bundling operation</title>
+            <para>
+                <code>cancelBundle</code> Cancels an Amazon EC2 bundling operation
+            </para>
+			<para>
+				<code>cancelBundle</code> returns a multi-demential array that contains
+				instanceId, bundleId, state, startTime, updateTime, progress
+				s3Bucket and s3Prefix.
+			</para>
+            <programlisting language="php"><![CDATA[
+$ec2_instance = new Zend_Service_Amazon_Ec2_Instance_Windows('aws_key',
+                                                     'aws_secret_key');
+$return = $ec2_instance->cancelBundle('bundleId');
+]]></programlisting>
+
+        </example>
+    </sect2>
+</sect1>

+ 4 - 5
library/Zend/Service/Amazon/Ec2/CloudWatch.php

@@ -307,12 +307,11 @@ class Zend_Service_Amazon_Ec2_CloudWatch extends Zend_Service_Amazon_Ec2_Abstrac
     }
 
     /**
-     * Return the Metrics that are aviable for your current monitored servers
+     * Return the Metrics that are aviable for your current monitored instances
      *
-     * @param string $nextToken     This call returns a list of up to 500 valid metrics
-     *                              for which there is recorded data available to a you and
-     *                              a NextToken string that can be used to query for the next
-     *                              set of results
+     * @param string $nextToken     The NextToken parameter is an optional parameter
+     * 								that allows you to retrieve the next set of results
+     * 								for your ListMetrics query.
      * @return array
      */
     public function listMetrics($nextToken = null)

+ 2 - 2
library/Zend/Service/Amazon/Ec2/Instance/Windows.php

@@ -119,7 +119,7 @@ class Zend_Service_Amazon_Ec2_Instance_Windows extends Zend_Service_Amazon_Ec2_A
      *                                          to find information for.
      * @return array                            Information for the task that you requested
      */
-    public function describeBundle($bundleId)
+    public function describeBundle($bundleId = '')
     {
         $params = array();
         $params['Action'] = 'DescribeBundleTasks';
@@ -128,7 +128,7 @@ class Zend_Service_Amazon_Ec2_Instance_Windows extends Zend_Service_Amazon_Ec2_A
             foreach($bundleId as $k=>$name) {
                 $params['bundleId.' . ($k+1)] = $name;
             }
-        } elseif($bundleId) {
+        } elseif(!empty($bundleId)) {
             $params['bundleId.1'] = $bundleId;
         }