File tree Expand file tree Collapse file tree 1 file changed +13
-18
lines changed
packages/google-cloud-dns/samples Expand file tree Collapse file tree 1 file changed +13
-18
lines changed Original file line number Diff line number Diff line change 19
19
// Imports the Google Cloud client library
20
20
const { DNS } = require ( '@google-cloud/dns' ) ;
21
21
22
- // Your Google Cloud Platform project ID
23
- const projectId = 'YOUR_PROJECT_ID' ;
22
+ async function quickStart ( ) {
23
+ // Your Google Cloud Platform project ID
24
+ const projectId = 'YOUR_PROJECT_ID' ;
24
25
25
- // Creates a client
26
- const dns = new DNS ( {
27
- projectId : projectId ,
28
- } ) ;
29
-
30
- // Lists all zones in the current project
31
- dns
32
- . getZones ( )
33
- . then ( results => {
34
- const zones = results [ 0 ] ;
35
-
36
- console . log ( 'Zones:' ) ;
37
- zones . forEach ( zone => console . log ( zone . name ) ) ;
38
- } )
39
- . catch ( err => {
40
- console . error ( 'ERROR:' , err ) ;
26
+ // Creates a client
27
+ const dns = new DNS ( {
28
+ projectId : projectId ,
41
29
} ) ;
30
+
31
+ // Lists all zones in the current project
32
+ const [ zones ] = await dns . getZones ( ) ;
33
+ console . log ( 'Zones:' ) ;
34
+ zones . forEach ( zone => console . log ( zone . name ) ) ;
35
+ }
36
+ quickStart ( ) . catch ( console . error ) ;
42
37
// [END dns_quickstart]
You can’t perform that action at this time.
0 commit comments