0
votes

I'm using java script to create/delate/restart instances in google cloud compute engine, create and delete works fine but with reset I have some issues.

function resetInstances() {
                var request = gapi.client.compute.instances.reset({
                    'project': 'project-name',
                    'name': 'instaces-name',
                    'zone': 'europe-west1-a'
                });
                executeRequest(request, 'resetInstances');
            }

API_VERSION = 'v1beta16', I have the same issues with v1. scopes = 'https://www.googleapis.com/auth/compute';

When I execute gapi.client.compute.instances.reset method I get "undefined" nothing more ;/ Could you provide me with some information to help me resolve this issues.

1

1 Answers

4
votes

The instance name parameter should be 'instance' rather than 'name'. Try the following code:

function resetInstances() {
  var request = gapi.client.compute.instances.reset({
    'project': 'project-name',
    'instance': 'instance-name',
    'zone': 'europe-west1-a'
  });
  executeRequest(request, 'resetInstances');
}