Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: pkg/gcloud/examples/x.dart

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/gcloud/examples/key.json ('k') | pkg/gcloud/lib/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import 'dart:async';
2
3 import 'package:googleapis_auth/auth_io.dart' as auth;
4 import 'package:gcloud/storage.dart';
5 import 'package:gcloud/http.dart';
6 import 'package:gcloud/service_scope.dart' as ss;
7
8 Future runApp() {
9 // The `runApp` function runs inside a context and can therefore
10 // access any registered values. In this case we use the `storage`
11 // object. But the `authenticatedClient` object is available as well.
12 return storageService.listBucketNames().listen(print).asFuture();
13 }
14
15 main() {
16 // Assumes we are running on a ComputeEngine VM with the storage scopes
17 // enabled.
18 auth.clientViaMetadataServer().then((httpClient) {
19 // Creates a new context and runs the given closure inside it.
20 ss.fork(() {
21 ss.registerScopeExitCallback(httpClient.close);
22
23 // We register the HTTP client.
24 registerAuthClientService(httpClient);
25
26 // We register the storage object inside the newly created service scope.
27 // This makes it available to all code running inside this context.
28 registerStorageService(new Storage(httpClient, 'my-project-id'));
29 return runApp();
30 });
31 });
32 }
OLDNEW
« no previous file with comments | « pkg/gcloud/examples/key.json ('k') | pkg/gcloud/lib/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698