| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* Copyright 2010-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the Apache License, Version 2.0 (the "License").
|
|
|
6 |
* You may not use this file except in compliance with the License.
|
|
|
7 |
* A copy of the License is located at
|
|
|
8 |
*
|
|
|
9 |
* http://aws.amazon.com/apache2.0
|
|
|
10 |
*
|
|
|
11 |
* or in the "license" file accompanying this file. This file is distributed
|
|
|
12 |
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
|
13 |
* express or implied. See the License for the specific language governing
|
|
|
14 |
* permissions and limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* This is the AWS CloudFormation API Reference. The major sections of this guide are described in
|
|
|
19 |
* the following table.
|
|
|
20 |
*
|
|
|
21 |
* <ul>
|
|
|
22 |
* <li><a href=
|
|
|
23 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_Operations.html">
|
|
|
24 |
* Actions</a>: Alphabetical list of CloudFormation actions</li>
|
|
|
25 |
* <li><a href=
|
|
|
26 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_Types.html">Data
|
|
|
27 |
* Types</a>: Alphabetical list of CloudFormation data types</li>
|
|
|
28 |
* <li><a href=
|
|
|
29 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/CommonParameters.html">
|
|
|
30 |
* Common Parameters</a>: Parameters that all Query actions can use</li>
|
|
|
31 |
* <li><a href=
|
|
|
32 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/CommonErrors.html">
|
|
|
33 |
* Common Errors</a>: Client and server errors that all actions can return</li>
|
|
|
34 |
* </ul>
|
|
|
35 |
*
|
|
|
36 |
* This guide is for programmers who need detailed information about the CloudFormation APIs. You
|
|
|
37 |
* use AWS CloudFormation to create and manage AWS infrastructure deployments predictably and
|
|
|
38 |
* repeatedly. CloudFormation helps you leverage AWS products such as Amazon EC2, EBS, Amazon SNS,
|
|
|
39 |
* ELB, and Auto Scaling to build highly-reliable, highly scalable, cost effective applications
|
|
|
40 |
* without worrying about creating and configuring the underlying the AWS infrastructure.
|
|
|
41 |
*
|
|
|
42 |
* Through the use of a template file you write, and a few AWS CloudFormation commands or API
|
|
|
43 |
* actions, AWS CloudFormation enables you to manage a collection of resources together as a
|
|
|
44 |
* single unit called a stack. AWS CloudFormation creates and deletes all member resources of the
|
|
|
45 |
* stack together and manages all dependencies between the resources for you.
|
|
|
46 |
*
|
|
|
47 |
* For more information about this product, go to the <a href=
|
|
|
48 |
* "http://aws.amazon.com/cloudformation/">CloudFormation Product Page</a>.
|
|
|
49 |
*
|
|
|
50 |
* Amazon CloudFormation makes use of other AWS products. If you need additional technical
|
|
|
51 |
* information about a specific AWS product, you can find the product's technical documentation at
|
|
|
52 |
* <a href="http://aws.amazon.com/documentation/">http://aws.amazon.com/documentation/</a>.
|
|
|
53 |
*
|
|
|
54 |
* @version 2011.12.13
|
|
|
55 |
* @license See the included NOTICE.md file for complete information.
|
|
|
56 |
* @copyright See the included NOTICE.md file for complete information.
|
|
|
57 |
* @link http://aws.amazon.com/cloudformation/ AWS CloudFormation
|
|
|
58 |
* @link http://aws.amazon.com/cloudformation/documentation/ AWS CloudFormation documentation
|
|
|
59 |
*/
|
|
|
60 |
class AmazonCloudFormation extends CFRuntime
|
|
|
61 |
{
|
|
|
62 |
/*%******************************************************************************************%*/
|
|
|
63 |
// CLASS CONSTANTS
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Specify the queue URL for the United States East (Northern Virginia) Region.
|
|
|
67 |
*/
|
|
|
68 |
const REGION_US_E1 = 'cloudformation.us-east-1.amazonaws.com';
|
|
|
69 |
|
|
|
70 |
/**
|
|
|
71 |
* Specify the queue URL for the United States East (Northern Virginia) Region.
|
|
|
72 |
*/
|
|
|
73 |
const REGION_VIRGINIA = self::REGION_US_E1;
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Specify the queue URL for the United States West (Northern California) Region.
|
|
|
77 |
*/
|
|
|
78 |
const REGION_US_W1 = 'cloudformation.us-west-1.amazonaws.com';
|
|
|
79 |
|
|
|
80 |
/**
|
|
|
81 |
* Specify the queue URL for the United States West (Northern California) Region.
|
|
|
82 |
*/
|
|
|
83 |
const REGION_CALIFORNIA = self::REGION_US_W1;
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Specify the queue URL for the United States West (Oregon) Region.
|
|
|
87 |
*/
|
|
|
88 |
const REGION_US_W2 = 'cloudformation.us-west-2.amazonaws.com';
|
|
|
89 |
|
|
|
90 |
/**
|
|
|
91 |
* Specify the queue URL for the United States West (Oregon) Region.
|
|
|
92 |
*/
|
|
|
93 |
const REGION_OREGON = self::REGION_US_W2;
|
|
|
94 |
|
|
|
95 |
/**
|
|
|
96 |
* Specify the queue URL for the Europe West (Ireland) Region.
|
|
|
97 |
*/
|
|
|
98 |
const REGION_EU_W1 = 'cloudformation.eu-west-1.amazonaws.com';
|
|
|
99 |
|
|
|
100 |
/**
|
|
|
101 |
* Specify the queue URL for the Europe West (Ireland) Region.
|
|
|
102 |
*/
|
|
|
103 |
const REGION_IRELAND = self::REGION_EU_W1;
|
|
|
104 |
|
|
|
105 |
/**
|
|
|
106 |
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
|
|
|
107 |
*/
|
|
|
108 |
const REGION_APAC_SE1 = 'cloudformation.ap-southeast-1.amazonaws.com';
|
|
|
109 |
|
|
|
110 |
/**
|
|
|
111 |
* Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
|
|
|
112 |
*/
|
|
|
113 |
const REGION_SINGAPORE = self::REGION_APAC_SE1;
|
|
|
114 |
|
|
|
115 |
/**
|
|
|
116 |
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
|
|
|
117 |
*/
|
|
|
118 |
const REGION_APAC_NE1 = 'cloudformation.ap-northeast-1.amazonaws.com';
|
|
|
119 |
|
|
|
120 |
/**
|
|
|
121 |
* Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
|
|
|
122 |
*/
|
|
|
123 |
const REGION_TOKYO = self::REGION_APAC_NE1;
|
|
|
124 |
|
|
|
125 |
/**
|
|
|
126 |
* Specify the queue URL for the South America (Sao Paulo) Region.
|
|
|
127 |
*/
|
|
|
128 |
const REGION_SA_E1 = 'cloudformation.sa-east-1.amazonaws.com';
|
|
|
129 |
|
|
|
130 |
/**
|
|
|
131 |
* Specify the queue URL for the South America (Sao Paulo) Region.
|
|
|
132 |
*/
|
|
|
133 |
const REGION_SAO_PAULO = self::REGION_SA_E1;
|
|
|
134 |
|
|
|
135 |
/**
|
|
|
136 |
* Default service endpoint.
|
|
|
137 |
*/
|
|
|
138 |
const DEFAULT_URL = self::REGION_US_E1;
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
/*%******************************************************************************************%*/
|
|
|
142 |
// CONSTRUCTOR
|
|
|
143 |
|
|
|
144 |
/**
|
|
|
145 |
* Constructs a new instance of <AmazonCloudFormation>.
|
|
|
146 |
*
|
|
|
147 |
* @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
148 |
* <li><code>certificate_authority</code> - <code>boolean</code> - Optional - Determines which Cerificate Authority file to use. A value of boolean <code>false</code> will use the Certificate Authority file available on the system. A value of boolean <code>true</code> will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to <code>0755</code>) will use that. Leave this set to <code>false</code> if you're not sure.</li>
|
|
|
149 |
* <li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
|
|
|
150 |
* <li><code>default_cache_config</code> - <code>string</code> - Optional - This option allows a preferred storage type to be configured for long-term caching. This can be changed later using the <set_cache_config()> method. Valid values are: <code>apc</code>, <code>xcache</code>, or a file system path such as <code>./cache</code> or <code>/tmp/cache/</code>.</li>
|
|
|
151 |
* <li><code>key</code> - <code>string</code> - Optional - Your AWS key, or a session key. If blank, the default credential set will be used.</li>
|
|
|
152 |
* <li><code>secret</code> - <code>string</code> - Optional - Your AWS secret key, or a session secret key. If blank, the default credential set will be used.</li>
|
|
|
153 |
* <li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
|
|
|
154 |
* @return void
|
|
|
155 |
*/
|
|
|
156 |
public function __construct(array $options = array())
|
|
|
157 |
{
|
|
|
158 |
$this->api_version = '2010-05-15';
|
|
|
159 |
$this->hostname = self::DEFAULT_URL;
|
|
|
160 |
$this->auth_class = 'AuthV2Query';
|
|
|
161 |
|
|
|
162 |
return parent::__construct($options);
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
/*%******************************************************************************************%*/
|
|
|
167 |
// SETTERS
|
|
|
168 |
|
|
|
169 |
/**
|
|
|
170 |
* This allows you to explicitly sets the region for the service to use.
|
|
|
171 |
*
|
|
|
172 |
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>, <REGION_SA_E1>.
|
|
|
173 |
* @return $this A reference to the current instance.
|
|
|
174 |
*/
|
|
|
175 |
public function set_region($region)
|
|
|
176 |
{
|
|
|
177 |
// @codeCoverageIgnoreStart
|
|
|
178 |
$this->set_hostname($region);
|
|
|
179 |
return $this;
|
|
|
180 |
// @codeCoverageIgnoreEnd
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
/*%******************************************************************************************%*/
|
|
|
185 |
// SERVICE METHODS
|
|
|
186 |
|
|
|
187 |
/**
|
|
|
188 |
* Creates a stack as specified in the template. After the call completes successfully, the stack
|
|
|
189 |
* creation starts. You can check the status of the stack via the <code>DescribeStacks</code> API.
|
|
|
190 |
*
|
|
|
191 |
* <p class="note">
|
|
|
192 |
* Currently, the limit for stacks is 20 stacks per account per region.
|
|
|
193 |
* </p>
|
|
|
194 |
*
|
|
|
195 |
* @param string $stack_name (Required) The name associated with the stack. The name must be unique within your AWS account. <p class="note">Must contain only alphanumeric characters (case sensitive) and start with an alpha character. Maximum length of the name is 255 characters.</p>
|
|
|
196 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
197 |
* <li><code>TemplateBody</code> - <code>string</code> - Optional - Structure containing the template body. (For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>.) Conditional: You must pass <code>TemplateBody</code> or <code>TemplateURL</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
198 |
* <li><code>TemplateURL</code> - <code>string</code> - Optional - Location of file containing the template body. The URL must point to a template located in an S3 bucket in the same region as the stack. For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>. Conditional: You must pass <code>TemplateURL</code> or <code>TemplateBody</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
199 |
* <li><code>Parameters</code> - <code>array</code> - Optional - A list of <code>Parameter</code> structures that specify input parameters for the stack. <ul>
|
|
|
200 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
|
|
201 |
* <li><code>ParameterKey</code> - <code>string</code> - Optional - The key associated with the parameter.</li>
|
|
|
202 |
* <li><code>ParameterValue</code> - <code>string</code> - Optional - The value associated with the parameter.</li>
|
|
|
203 |
* </ul></li>
|
|
|
204 |
* </ul></li>
|
|
|
205 |
* <li><code>DisableRollback</code> - <code>boolean</code> - Optional - Boolean to enable or disable rollback on stack creation failures.<br/>Default: <code>false</code></li>
|
|
|
206 |
* <li><code>TimeoutInMinutes</code> - <code>integer</code> - Optional - The amount of time that can pass before the stack status becomes CREATE_FAILED; if <code>DisableRollback</code> is not set or is set to <code>false</code>, the stack will be rolled back.</li>
|
|
|
207 |
* <li><code>NotificationARNs</code> - <code>string|array</code> - Optional - The Simple Notification Service (SNS) topic ARNs to publish stack related events. You can find your SNS topic ARNs using the <a href="http://console.aws.amazon.com/sns">SNS console</a> or your Command Line Interface (CLI). Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
208 |
* <li><code>Capabilities</code> - <code>string|array</code> - Optional - The list of capabilities that you want to allow in the stack. If your template contains IAM resources, you must specify the CAPABILITY_IAM value for this parameter; otherwise, this action returns an InsufficientCapabilities error. IAM resources are the following: <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html">AWS::IAM::AccessKey</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html">AWS::IAM::Group</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html">AWS::IAM::Policy</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html">AWS::IAM::User</a>, and <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html">AWS::IAM::UserToGroupAddition</a>. Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
209 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
210 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
211 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
212 |
*/
|
|
|
213 |
public function create_stack($stack_name, $opt = null)
|
|
|
214 |
{
|
|
|
215 |
if (!$opt) $opt = array();
|
|
|
216 |
$opt['StackName'] = $stack_name;
|
|
|
217 |
|
|
|
218 |
// Optional list + map
|
|
|
219 |
if (isset($opt['Parameters']))
|
|
|
220 |
{
|
|
|
221 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
222 |
'Parameters' => $opt['Parameters']
|
|
|
223 |
), 'member'));
|
|
|
224 |
unset($opt['Parameters']);
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
// Optional list (non-map)
|
|
|
228 |
if (isset($opt['NotificationARNs']))
|
|
|
229 |
{
|
|
|
230 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
231 |
'NotificationARNs' => (is_array($opt['NotificationARNs']) ? $opt['NotificationARNs'] : array($opt['NotificationARNs']))
|
|
|
232 |
), 'member'));
|
|
|
233 |
unset($opt['NotificationARNs']);
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
// Optional list (non-map)
|
|
|
237 |
if (isset($opt['Capabilities']))
|
|
|
238 |
{
|
|
|
239 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
240 |
'Capabilities' => (is_array($opt['Capabilities']) ? $opt['Capabilities'] : array($opt['Capabilities']))
|
|
|
241 |
), 'member'));
|
|
|
242 |
unset($opt['Capabilities']);
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
return $this->authenticate('CreateStack', $opt);
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
/**
|
|
|
249 |
* Deletes a specified stack. Once the call completes successfully, stack deletion starts. Deleted
|
|
|
250 |
* stacks do not show up in the <code>DescribeStacks</code> API if the deletion has been completed
|
|
|
251 |
* successfully.
|
|
|
252 |
*
|
|
|
253 |
* @param string $stack_name (Required) The name or the unique identifier associated with the stack.
|
|
|
254 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
255 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
256 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
257 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
258 |
*/
|
|
|
259 |
public function delete_stack($stack_name, $opt = null)
|
|
|
260 |
{
|
|
|
261 |
if (!$opt) $opt = array();
|
|
|
262 |
$opt['StackName'] = $stack_name;
|
|
|
263 |
|
|
|
264 |
return $this->authenticate('DeleteStack', $opt);
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
/**
|
|
|
268 |
* Returns all the stack related events for the AWS account. If <code>StackName</code> is
|
|
|
269 |
* specified, returns events related to all the stacks with the given name. If
|
|
|
270 |
* <code>StackName</code> is not specified, returns all the events for the account. For more
|
|
|
271 |
* information about a stack's event history, go to the <a href=
|
|
|
272 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User
|
|
|
273 |
* Guide</a>.
|
|
|
274 |
*
|
|
|
275 |
* <p class="note">
|
|
|
276 |
* Events are returned, even if the stack never existed or has been successfully deleted.
|
|
|
277 |
* </p>
|
|
|
278 |
*
|
|
|
279 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
280 |
* <li><code>StackName</code> - <code>string</code> - Optional - The name or the unique identifier associated with the stack.<br/>Default: There is no default value.</li>
|
|
|
281 |
* <li><code>NextToken</code> - <code>string</code> - Optional - String that identifies the start of the next list of events, if there is one.<br/>Default: There is no default value.</li>
|
|
|
282 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
283 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
284 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
285 |
*/
|
|
|
286 |
public function describe_stack_events($opt = null)
|
|
|
287 |
{
|
|
|
288 |
if (!$opt) $opt = array();
|
|
|
289 |
|
|
|
290 |
return $this->authenticate('DescribeStackEvents', $opt);
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
/**
|
|
|
294 |
* Returns a description of the specified resource in the specified stack.
|
|
|
295 |
*
|
|
|
296 |
* For deleted stacks, DescribeStackResource returns resource information for up to 90 days after
|
|
|
297 |
* the stack has been deleted.
|
|
|
298 |
*
|
|
|
299 |
* @param string $stack_name (Required) The name or the unique identifier associated with the stack. Default: There is no default value.
|
|
|
300 |
* @param string $logical_resource_id (Required) The logical name of the resource as specified in the template.<br/>Default: There is on default value.
|
|
|
301 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
302 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
303 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
304 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
305 |
*/
|
|
|
306 |
public function describe_stack_resource($stack_name, $logical_resource_id, $opt = null)
|
|
|
307 |
{
|
|
|
308 |
if (!$opt) $opt = array();
|
|
|
309 |
$opt['StackName'] = $stack_name;
|
|
|
310 |
$opt['LogicalResourceId'] = $logical_resource_id;
|
|
|
311 |
|
|
|
312 |
return $this->authenticate('DescribeStackResource', $opt);
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
/**
|
|
|
316 |
* Returns AWS resource descriptions for running and deleted stacks. If <code>StackName</code> is
|
|
|
317 |
* specified, all the associated resources that are part of the stack are returned. If
|
|
|
318 |
* <code>PhysicalResourceId</code> is specified, all the associated resources of the stack the
|
|
|
319 |
* resource belongs to are returned.
|
|
|
320 |
*
|
|
|
321 |
* For deleted stacks, DescribeStackResources returns resource information for up to 90 days after
|
|
|
322 |
* the stack has been deleted.
|
|
|
323 |
*
|
|
|
324 |
* You must specify <code>StackName</code> or <code>PhysicalResourceId.</code> In addition, you
|
|
|
325 |
* can specify <code>LogicalResourceId</code> to filter the returned result. For more information
|
|
|
326 |
* about resources, the <code>LogicalResourceId</code> and <code>PhysicalResourceId</code>, go to
|
|
|
327 |
* the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS
|
|
|
328 |
* CloudFormation User Guide</a>.
|
|
|
329 |
*
|
|
|
330 |
* <p class="note">
|
|
|
331 |
* A <code>ValidationError</code> is returned if you specify both <code>StackName</code> and
|
|
|
332 |
* <code>PhysicalResourceId</code> in the same request.
|
|
|
333 |
* </p>
|
|
|
334 |
*
|
|
|
335 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
336 |
* <li><code>StackName</code> - <code>string</code> - Optional - The name or the unique identifier associated with the stack. Default: There is no default value.</li>
|
|
|
337 |
* <li><code>LogicalResourceId</code> - <code>string</code> - Optional - The logical name of the resource as specified in the template.<br/>Default: There is on default value.</li>
|
|
|
338 |
* <li><code>PhysicalResourceId</code> - <code>string</code> - Optional - The name or unique identifier that corresponds to a physical instance ID of a resource supported by AWS CloudFormation. For example, for an Amazon Elastic Compute Cloud (EC2) instance, <code>PhysicalResourceId</code> corresponds to the <code>InstanceId</code>. You can pass the EC2 <code>InstanceId</code> to <code>DescribeStackResources</code> to find which stack the instance belongs to and what other resources are part of the stack. Default: There is no default value.</li>
|
|
|
339 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
340 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
341 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
342 |
*/
|
|
|
343 |
public function describe_stack_resources($opt = null)
|
|
|
344 |
{
|
|
|
345 |
if (!$opt) $opt = array();
|
|
|
346 |
|
|
|
347 |
return $this->authenticate('DescribeStackResources', $opt);
|
|
|
348 |
}
|
|
|
349 |
|
|
|
350 |
/**
|
|
|
351 |
* Returns the description for the specified stack; if no stack name was specified, then it
|
|
|
352 |
* returns the description for all the stacks created.
|
|
|
353 |
*
|
|
|
354 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
355 |
* <li><code>StackName</code> - <code>string</code> - Optional - The name or the unique identifier associated with the stack. Default: There is no default value.</li>
|
|
|
356 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
357 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
358 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
359 |
*/
|
|
|
360 |
public function describe_stacks($opt = null)
|
|
|
361 |
{
|
|
|
362 |
if (!$opt) $opt = array();
|
|
|
363 |
|
|
|
364 |
return $this->authenticate('DescribeStacks', $opt);
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
/**
|
|
|
368 |
* Returns the estimated monthly cost of a template. The return value is an AWS Simply Monthly
|
|
|
369 |
* Calculator URL with a query string that describes the resources required to run the template.
|
|
|
370 |
*
|
|
|
371 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
372 |
* <li><code>TemplateBody</code> - <code>string</code> - Optional - Structure containing the template body. (For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>.) Conditional: You must pass <code>TemplateBody</code> or <code>TemplateURL</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
373 |
* <li><code>TemplateURL</code> - <code>string</code> - Optional - Location of file containing the template body. The URL must point to a template located in an S3 bucket in the same region as the stack. For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>. Conditional: You must pass <code>TemplateURL</code> or <code>TemplateBody</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
374 |
* <li><code>Parameters</code> - <code>array</code> - Optional - A list of <code>Parameter</code> structures that specify input parameters. <ul>
|
|
|
375 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
|
|
376 |
* <li><code>ParameterKey</code> - <code>string</code> - Optional - The key associated with the parameter.</li>
|
|
|
377 |
* <li><code>ParameterValue</code> - <code>string</code> - Optional - The value associated with the parameter.</li>
|
|
|
378 |
* </ul></li>
|
|
|
379 |
* </ul></li>
|
|
|
380 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
381 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
382 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
383 |
*/
|
|
|
384 |
public function estimate_template_cost($opt = null)
|
|
|
385 |
{
|
|
|
386 |
if (!$opt) $opt = array();
|
|
|
387 |
|
|
|
388 |
// Optional list + map
|
|
|
389 |
if (isset($opt['Parameters']))
|
|
|
390 |
{
|
|
|
391 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
392 |
'Parameters' => $opt['Parameters']
|
|
|
393 |
), 'member'));
|
|
|
394 |
unset($opt['Parameters']);
|
|
|
395 |
}
|
|
|
396 |
|
|
|
397 |
return $this->authenticate('EstimateTemplateCost', $opt);
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
/**
|
|
|
401 |
* Returns the template body for a specified stack name. You can get the template for running or
|
|
|
402 |
* deleted stacks.
|
|
|
403 |
*
|
|
|
404 |
* For deleted stacks, GetTemplate returns the template for up to 90 days after the stack has been
|
|
|
405 |
* deleted.
|
|
|
406 |
*
|
|
|
407 |
* <p class="note">
|
|
|
408 |
* If the template does not exist, a <code>ValidationError</code> is returned.
|
|
|
409 |
* </p>
|
|
|
410 |
*
|
|
|
411 |
* @param string $stack_name (Required) The name or the unique identifier associated with the stack.
|
|
|
412 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
413 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
414 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
415 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
416 |
*/
|
|
|
417 |
public function get_template($stack_name, $opt = null)
|
|
|
418 |
{
|
|
|
419 |
if (!$opt) $opt = array();
|
|
|
420 |
$opt['StackName'] = $stack_name;
|
|
|
421 |
|
|
|
422 |
return $this->authenticate('GetTemplate', $opt);
|
|
|
423 |
}
|
|
|
424 |
|
|
|
425 |
/**
|
|
|
426 |
* Returns descriptions of all resources of the specified stack.
|
|
|
427 |
*
|
|
|
428 |
* For deleted stacks, ListStackResources returns resource information for up to 90 days after the
|
|
|
429 |
* stack has been deleted.
|
|
|
430 |
*
|
|
|
431 |
* @param string $stack_name (Required) The name or the unique identifier associated with the stack. Default: There is no default value.
|
|
|
432 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
433 |
* <li><code>NextToken</code> - <code>string</code> - Optional - String that identifies the start of the next list of events, if there is one. Default: There is no default value.</li>
|
|
|
434 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
435 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
436 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
437 |
*/
|
|
|
438 |
public function list_stack_resources($stack_name, $opt = null)
|
|
|
439 |
{
|
|
|
440 |
if (!$opt) $opt = array();
|
|
|
441 |
$opt['StackName'] = $stack_name;
|
|
|
442 |
|
|
|
443 |
return $this->authenticate('ListStackResources', $opt);
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
/**
|
|
|
447 |
* Returns the summary information for stacks whose status matches the specified
|
|
|
448 |
* StackStatusFilter. Summary information for stacks that have been deleted is kept for 90 days
|
|
|
449 |
* after the stack is deleted. If no StackStatusFilter is specified, summary information for all
|
|
|
450 |
* stacks is returned (including existing stacks and stacks that have been deleted).
|
|
|
451 |
*
|
|
|
452 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
453 |
* <li><code>NextToken</code> - <code>string</code> - Optional - </li>
|
|
|
454 |
* <li><code>StackStatusFilter</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
455 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
456 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
457 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
458 |
*/
|
|
|
459 |
public function list_stacks($opt = null)
|
|
|
460 |
{
|
|
|
461 |
if (!$opt) $opt = array();
|
|
|
462 |
|
|
|
463 |
// Optional list (non-map)
|
|
|
464 |
if (isset($opt['StackStatusFilter']))
|
|
|
465 |
{
|
|
|
466 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
467 |
'StackStatusFilter' => (is_array($opt['StackStatusFilter']) ? $opt['StackStatusFilter'] : array($opt['StackStatusFilter']))
|
|
|
468 |
), 'member'));
|
|
|
469 |
unset($opt['StackStatusFilter']);
|
|
|
470 |
}
|
|
|
471 |
|
|
|
472 |
return $this->authenticate('ListStacks', $opt);
|
|
|
473 |
}
|
|
|
474 |
|
|
|
475 |
/**
|
|
|
476 |
* Updates a stack as specified in the template. After the call completes successfully, the stack
|
|
|
477 |
* update starts. You can check the status of the stack via the <code>DescribeStacks</code>
|
|
|
478 |
* action.
|
|
|
479 |
*
|
|
|
480 |
* To get a copy of the template for an existing stack, you can use the <code>GetTemplate</code>
|
|
|
481 |
* action.
|
|
|
482 |
*
|
|
|
483 |
* For more information about creating an update template, updating a stack, and monitoring the
|
|
|
484 |
* progress of the update, see <a href=
|
|
|
485 |
* "http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html">
|
|
|
486 |
* Updating a Stack</a>.
|
|
|
487 |
*
|
|
|
488 |
* @param string $stack_name (Required) The name or stack ID of the stack to update. <p class="note">Must contain only alphanumeric characters (case sensitive) and start with an alpha character. Maximum length of the name is 255 characters.</p>
|
|
|
489 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
490 |
* <li><code>TemplateBody</code> - <code>string</code> - Optional - Structure containing the template body. (For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>.) Conditional: You must pass <code>TemplateBody</code> or <code>TemplateURL</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
491 |
* <li><code>TemplateURL</code> - <code>string</code> - Optional - Location of file containing the template body. The URL must point to a template located in an S3 bucket in the same region as the stack. For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>. Conditional: You must pass <code>TemplateURL</code> or <code>TemplateBody</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
492 |
* <li><code>Parameters</code> - <code>array</code> - Optional - A list of <code>Parameter</code> structures that specify input parameters for the stack. <ul>
|
|
|
493 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
|
|
494 |
* <li><code>ParameterKey</code> - <code>string</code> - Optional - The key associated with the parameter.</li>
|
|
|
495 |
* <li><code>ParameterValue</code> - <code>string</code> - Optional - The value associated with the parameter.</li>
|
|
|
496 |
* </ul></li>
|
|
|
497 |
* </ul></li>
|
|
|
498 |
* <li><code>Capabilities</code> - <code>string|array</code> - Optional - The list of capabilities that you want to allow in the stack. If your stack contains IAM resources, you must specify the CAPABILITY_IAM value for this parameter; otherwise, this action returns an InsufficientCapabilities error. IAM resources are the following: <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html">AWS::IAM::AccessKey</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html">AWS::IAM::Group</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html">AWS::IAM::Policy</a>, <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html">AWS::IAM::User</a>, and <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html">AWS::IAM::UserToGroupAddition</a>. Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
499 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
500 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
501 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
502 |
*/
|
|
|
503 |
public function update_stack($stack_name, $opt = null)
|
|
|
504 |
{
|
|
|
505 |
if (!$opt) $opt = array();
|
|
|
506 |
$opt['StackName'] = $stack_name;
|
|
|
507 |
|
|
|
508 |
// Optional list + map
|
|
|
509 |
if (isset($opt['Parameters']))
|
|
|
510 |
{
|
|
|
511 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
512 |
'Parameters' => $opt['Parameters']
|
|
|
513 |
), 'member'));
|
|
|
514 |
unset($opt['Parameters']);
|
|
|
515 |
}
|
|
|
516 |
|
|
|
517 |
// Optional list (non-map)
|
|
|
518 |
if (isset($opt['Capabilities']))
|
|
|
519 |
{
|
|
|
520 |
$opt = array_merge($opt, CFComplexType::map(array(
|
|
|
521 |
'Capabilities' => (is_array($opt['Capabilities']) ? $opt['Capabilities'] : array($opt['Capabilities']))
|
|
|
522 |
), 'member'));
|
|
|
523 |
unset($opt['Capabilities']);
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
return $this->authenticate('UpdateStack', $opt);
|
|
|
527 |
}
|
|
|
528 |
|
|
|
529 |
/**
|
|
|
530 |
* Validates a specified template.
|
|
|
531 |
*
|
|
|
532 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
533 |
* <li><code>TemplateBody</code> - <code>string</code> - Optional - String containing the template body. (For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>.) Conditional: You must pass <code>TemplateURL</code> or <code>TemplateBody</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
534 |
* <li><code>TemplateURL</code> - <code>string</code> - Optional - Location of file containing the template body. The URL must point to a template located in an S3 bucket in the same region as the stack. For more information, go to the <a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide">AWS CloudFormation User Guide</a>. Conditional: You must pass <code>TemplateURL</code> or <code>TemplateBody</code>. If both are passed, only <code>TemplateBody</code> is used.</li>
|
|
|
535 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
|
|
536 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
|
|
537 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
|
|
538 |
*/
|
|
|
539 |
public function validate_template($opt = null)
|
|
|
540 |
{
|
|
|
541 |
if (!$opt) $opt = array();
|
|
|
542 |
|
|
|
543 |
return $this->authenticate('ValidateTemplate', $opt);
|
|
|
544 |
}
|
|
|
545 |
}
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
/*%******************************************************************************************%*/
|
|
|
549 |
// EXCEPTIONS
|
|
|
550 |
|
|
|
551 |
class CloudFormation_Exception extends Exception {}
|