Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

@google-cloud/resource v0.4.0

Choose a tag to compare

@lukesneeringer lukesneeringer released this 02 Nov 16:57
· 404 commits to main since this release

release level

⚠️ Breaking Changes!

We've updated to v1 of the upstream Resource Manager API!

The upstream Resource Manager API has made a significant change that affects our resource.createProject() method. Previously, when your callback was executed, you knew if the project was created successfully or not. Now, you will be returned an operation object, which you will subscribe to for updates.

Before

resource.createProject(id, function(err, project, apiResponse) {
  if (err) {
    // An API error occurred.
  }

  // Project was created successfully!
});

After

resource.createProject(id, function(err, project, operation, apiResponse) {
  if (err) {
    // An API error occurred.
  }

  // `operation` will emit `error` or `complete` when the status updates.

  operation
    .on('error', function(err) {})
    .on('complete', function() {
      // Project was created successfully!
    });
});

If you are using our promise API, you can use the Operation object as a promise.

resource.createProject(id)
  .then(function(data) {
    var operation = data[1];
    return operation.promise();
  })
  .then(function() {
    // Project was created successfully!
  });