Skip to content

Commit

Permalink
Updates endpoint version / name (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
gguuss authored Aug 1, 2017
1 parent ab08135 commit 221a1ed
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions iot/manager/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const fs = require('fs');
const google = require('googleapis');

const API_VERSION = 'v1alpha1';
const API_VERSION = 'v1beta1';
const DISCOVERY_API = 'https://cloudiot.googleapis.com/$discovery/rest';

// Configures the topic for Cloud IoT Core.
Expand Down Expand Up @@ -125,11 +125,11 @@ function lookupOrCreateRegistry (client, registryId, projectId, cloudRegion,

const request = {
parent: parentName,
id: registryId,
resource: {
eventNotificationConfig: {
pubsubTopicName: pubsubTopic
}
},
'id': registryId
}
};

Expand Down Expand Up @@ -167,8 +167,7 @@ function createUnauthDevice (client, deviceId, registryId, projectId,

const request = {
parent: registryName,
id: deviceId,
resource: body
resource: {id: deviceId}
};

client.projects.locations.registries.devices.create(request, (err, data) => {
Expand Down Expand Up @@ -196,6 +195,7 @@ function createRsaDevice (client, deviceId, registryId, projectId, cloudRegion,
const parentName = `projects/${projectId}/locations/${cloudRegion}`;
const registryName = `${parentName}/registries/${registryId}`;
const body = {
id: deviceId,
credentials: [
{
publicKey: {
Expand All @@ -208,7 +208,6 @@ function createRsaDevice (client, deviceId, registryId, projectId, cloudRegion,

const request = {
parent: registryName,
id: deviceId,
resource: body
};

Expand Down Expand Up @@ -239,6 +238,7 @@ function createEsDevice (client, deviceId, registryId, projectId, cloudRegion,
const parentName = `projects/${projectId}/locations/${cloudRegion}`;
const registryName = `${parentName}/registries/${registryId}`;
const body = {
id: deviceId,
credentials: [
{
publicKey: {
Expand All @@ -251,7 +251,6 @@ function createEsDevice (client, deviceId, registryId, projectId, cloudRegion,

const request = {
parent: registryName,
id: deviceId,
resource: body
};

Expand Down Expand Up @@ -590,7 +589,7 @@ require(`yargs`) // eslint-disable-line
(opts) => {
const cb = function (client) {
createUnauthDevice(client, opts.deviceId, opts.registryId,
opts.projectId, opts.cloudRegion, {});
opts.projectId, opts.cloudRegion);
};
getClient(opts.apiKey, opts.serviceAccount, cb);
}
Expand Down

0 comments on commit 221a1ed

Please sign in to comment.