@@ -120,52 +120,60 @@ function generateMarkup($apiRequestName, $apiResponse)
120120 * Google Compute Engine API request to retrieve the list of instances in your
121121 * Google Compute Engine project.
122122 */
123- $ instances = $ computeService ->instances ->listInstances (DEFAULT_PROJECT ,
124- DEFAULT_ZONE_NAME );
125- $ instancesListMarkup = generateMarkup ('List Instances ' , $ instances );
123+ $ instances = $ computeService ->instances ->listInstances (
124+ DEFAULT_PROJECT ,
125+ DEFAULT_ZONE_NAME
126+ );
126127
127- /**
128- * Google Compute Engine API request to retrieve the list of all data center
129- * locations associated with your Google Compute Engine project.
130- */
131- $ zones = $ computeService ->zones ->listZones (DEFAULT_PROJECT );
128+ $ instancesListMarkup = generateMarkup (
129+ 'List Instances ' ,
130+ $ instances
131+ );
132+
133+ /**
134+ * Google Compute Engine API request to retrieve the list of all data center
135+ * locations associated with your Google Compute Engine project.
136+ */
137+ $ zones = $ computeService ->zones ->listZones (DEFAULT_PROJECT );
132138 $ zonesListMarkup = generateMarkup ('List Zones ' , $ zones );
133139
134- /**
135- * Google Compute Engine API request to retrieve the list of all machine types
136- * associated associated with your Google Compute Engine project.
137- */
138- $ machineTypes = $ computeService ->machineTypes ->listMachineTypes (DEFAULT_PROJECT );
139- $ machineTypesListMarkup = generateMarkup ('List Machine Types ' ,
140- $ machineTypes );
140+ /**
141+ * Google Compute Engine API request to retrieve the list of all machine types
142+ * associated with your Google Compute Engine project.
143+ */
144+ $ machineTypes = $ computeService ->machineTypes ->listMachineTypes (DEFAULT_PROJECT );
145+ $ machineTypesListMarkup = generateMarkup (
146+ 'List Machine Types ' ,
147+ $ machineTypes
148+ );
141149
142- /**
143- * Google Compute Engine API request to retrieve the list of all image types
144- * associated associated with your Google Compute Engine project.
145- */
146- $ images = $ computeService ->images ->listImages (GOOGLE_PROJECT );
150+ /**
151+ * Google Compute Engine API request to retrieve the list of all image types
152+ * associated with your Google Compute Engine project.
153+ */
154+ $ images = $ computeService ->images ->listImages (GOOGLE_PROJECT );
147155 $ imagesListMarkup = generateMarkup ('List Images ' , $ images );
148156
149- /**
150- * Google Compute Engine API request to retrieve the list of all firewalls
151- * associated associated with your Google Compute Engine project.
152- */
153- $ firewalls = $ computeService ->firewalls ->listFirewalls (DEFAULT_PROJECT );
157+ /**
158+ * Google Compute Engine API request to retrieve the list of all firewalls
159+ * associated with your Google Compute Engine project.
160+ */
161+ $ firewalls = $ computeService ->firewalls ->listFirewalls (DEFAULT_PROJECT );
154162 $ firewallsListMarkup = generateMarkup ('List Firewalls ' , $ firewalls );
155163
156- /**
157- * Google Compute Engine API request to retrieve the list of all networks
158- * associated associated with your Google Compute Engine project.
159- */
160- $ networks = $ computeService ->networks ->listNetworks (DEFAULT_PROJECT );
164+ /**
165+ * Google Compute Engine API request to retrieve the list of all networks
166+ * associated with your Google Compute Engine project.
167+ */
168+ $ networks = $ computeService ->networks ->listNetworks (DEFAULT_PROJECT );
161169 $ networksListMarkup = generateMarkup ('List Networks ' , $ networks );
162170 ;
163171
164- /**
165- * Google Compute Engine API request to insert a new instance into your Google
166- * Compute Engine project.
167- */
168- $ name = DEFAULT_NAME ;
172+ /**
173+ * Google Compute Engine API request to insert a new instance into your Google
174+ * Compute Engine project.
175+ */
176+ $ name = DEFAULT_NAME ;
169177 $ machineType = DEFAULT_MACHINE_TYPE ;
170178 $ zone = DEFAULT_ZONE_NAME ;
171179 $ image = DEFAULT_IMAGE ;
@@ -184,11 +192,11 @@ function generateMarkup($apiRequestName, $apiResponse)
184192 $ zone , $ new_instance );
185193 $ insertInstanceMarkup = generateMarkup ('Insert Instance ' , $ insertInstance );
186194
187- /**
188- * Google Compute Engine API request to insert a new instance (with metadata)
189- * into your Google Compute Engine project.
190- */
191- $ name = DEFAULT_NAME_WITH_METADATA ;
195+ /**
196+ * Google Compute Engine API request to insert a new instance (with metadata)
197+ * into your Google Compute Engine project.
198+ */
199+ $ name = DEFAULT_NAME_WITH_METADATA ;
192200 $ machineType = DEFAULT_MACHINE_TYPE ;
193201 $ zone = DEFAULT_ZONE_NAME ;
194202 $ image = DEFAULT_IMAGE ;
@@ -212,53 +220,85 @@ function generateMarkup($apiRequestName, $apiResponse)
212220 $ new_instance ->setMetadata ($ metadata );
213221
214222 $ insertInstanceWithMetadata = $ computeService ->instances ->insert (
215- DEFAULT_PROJECT , $ zone , $ new_instance );
223+ DEFAULT_PROJECT ,
224+ $ zone ,
225+ $ new_instance
226+ );
227+
216228 $ insertInstanceWithMetadataMarkup = generateMarkup (
217- 'Insert Instance With Metadata ' , $ insertInstanceWithMetadata );
229+ 'Insert Instance With Metadata ' ,
230+ $ insertInstanceWithMetadata
231+ );
232+
233+ /**
234+ * Google Compute Engine API request to get an instance matching the outlined
235+ * parameters from your Google Compute Engine project.
236+ */
237+ $ getInstance = $ computeService ->instances ->get (
238+ DEFAULT_PROJECT ,
239+ DEFAULT_ZONE_NAME ,
240+ DEFAULT_NAME
241+ );
218242
219- /**
220- * Google Compute Engine API request to get an instance matching the outlined
221- * parameters from your Google Compute Engine project.
222- */
223- $ getInstance = $ computeService ->instances ->get (DEFAULT_PROJECT ,
224- DEFAULT_ZONE_NAME , DEFAULT_NAME );
225243 $ getInstanceMarkup = generateMarkup ('Get Instance ' , $ getInstance );
226244
227- /**
228- * Google Compute Engine API request to get an instance matching the outlined
229- * parameters from your Google Compute Engine project.
230- */
231- $ getInstanceWithMetadata = $ computeService ->instances ->get (DEFAULT_PROJECT ,
232- DEFAULT_ZONE_NAME , DEFAULT_NAME_WITH_METADATA );
233- $ getInstanceWithMetadataMarkup = generateMarkup ('Get Instance With Metadata ' ,
234- $ getInstanceWithMetadata );
235-
236- /**
237- * Google Compute Engine API request to delete an instance matching the
238- * outlined parameters from your Google Compute Engine project.
239- */
240- $ deleteInstance = $ computeService ->instances ->delete (DEFAULT_PROJECT ,
241- DEFAULT_ZONE_NAME , DEFAULT_NAME );
245+ /**
246+ * Google Compute Engine API request to get an instance matching the outlined
247+ * parameters from your Google Compute Engine project.
248+ */
249+ $ getInstanceWithMetadata = $ computeService ->instances ->get (
250+ DEFAULT_PROJECT ,
251+ DEFAULT_ZONE_NAME ,
252+ DEFAULT_NAME_WITH_METADATA
253+ );
254+
255+ $ getInstanceWithMetadataMarkup = generateMarkup (
256+ 'Get Instance With Metadata ' ,
257+ $ getInstanceWithMetadata
258+ );
259+
260+ /**
261+ * Google Compute Engine API request to delete an instance matching the
262+ * outlined parameters from your Google Compute Engine project.
263+ */
264+ $ deleteInstance = $ computeService ->instances ->delete (
265+ DEFAULT_PROJECT ,
266+ DEFAULT_ZONE_NAME ,
267+ DEFAULT_NAME
268+ );
269+
242270 $ deleteInstanceMarkup = generateMarkup ('Delete Instance ' , $ deleteInstance );
243271
244- /**
245- * Google Compute Engine API request to delete an instance matching the
246- * outlined parameters from your Google Compute Engine project.
247- */
248- $ deleteInstanceWithMetadata = $ computeService ->instances ->delete (DEFAULT_PROJECT ,
249- DEFAULT_ZONE_NAME , DEFAULT_NAME_WITH_METADATA );
250- $ deleteInstanceWithMetadataMarkup = generateMarkup (
251- 'Delete Instance With Metadata ' , $ deleteInstanceWithMetadata );
272+ /**
273+ * Google Compute Engine API request to delete an instance matching the
274+ * outlined parameters from your Google Compute Engine project.
275+ */
276+ $ deleteInstanceWithMetadata = $ computeService ->instances ->delete (
277+ DEFAULT_PROJECT ,
278+ DEFAULT_ZONE_NAME ,
279+ DEFAULT_NAME_WITH_METADATA
280+ );
252281
253- /**
254- * Google Compute Engine API request to retrieve the list of all global
255- * operations associated with your Google Compute Engine project.
256- */
257- $ globalOperations = $ computeService ->globalOperations ->listGlobalOperations (DEFAULT_PROJECT );
258- $ operationsListMarkup = generateMarkup ('List Global Operations ' , $ globalOperations );
282+ $ deleteInstanceWithMetadataMarkup = generateMarkup (
283+ 'Delete Instance With Metadata ' ,
284+ $ deleteInstanceWithMetadata
285+ );
259286
260- // The access token may have been updated lazily.
261- $ _SESSION ['access_token ' ] = $ client ->getAccessToken ();
287+ /**
288+ * Google Compute Engine API request to retrieve the list of all global
289+ * operations associated with your Google Compute Engine project.
290+ */
291+ $ globalOperations = $ computeService ->globalOperations ->listGlobalOperations (
292+ DEFAULT_PROJECT
293+ );
294+
295+ $ operationsListMarkup = generateMarkup (
296+ 'List Global Operations ' ,
297+ $ globalOperations
298+ );
299+
300+ // The access token may have been updated lazily.
301+ $ _SESSION ['access_token ' ] = $ client ->getAccessToken ();
262302} else {
263303 $ authUrl = $ client ->createAuthUrl ();
264304}
0 commit comments