Skip to content

Updates endpoint version / name #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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