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

fix: update root url to compute.googleapis.com #349

Merged
merged 8 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Image = require('./image.js');
* attempted before returning the error.
* @property {Constructor} [promise] Custom promise module to use instead of
* native Promises.
* @property {string} [apiEndpoint] The API endpoint of the service used to make requests. Defaults to `www.googleapis.com`
* @property {string} [apiEndpoint] The API endpoint of the service used to make requests. Defaults to `compute.googleapis.com`
*/
/**
* @see [What is Google Compute Engine?]{@link https://cloud.google.com/compute/docs}
Expand All @@ -80,7 +80,7 @@ const Image = require('./image.js');
*/
class Compute extends common.Service {
constructor(options = {}) {
options.apiEndpoint = options.apiEndpoint || 'www.googleapis.com';
options.apiEndpoint = options.apiEndpoint || 'compute.googleapis.com';
const config = {
apiEndpoint: options.apiEndpoint,
baseUrl: `https://${options.apiEndpoint}/compute/v1`,
Expand Down
2 changes: 1 addition & 1 deletion src/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ class Zone extends common.ServiceObject {
* boot: true,
* initializeParams: {
* sourceImage:
* 'https://www.googleapis.com/compute/v1/projects' +
* 'https://compute.googleapis.com/compute/v1/projects' +
* '/debian-cloud/global/images/debian-7-wheezy-v20150710'
* }
* }
Expand Down
12 changes: 7 additions & 5 deletions system-test/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('Compute', () => {
await createInstanceGroupManager(
INSTANCE_GROUP_MANAGER_NAME,
[
'https://www.googleapis.com/compute/v1/projects',
'https://compute.googleapis.com/compute/v1/projects',
compute.projectId,
'global/instanceTemplates',
INSTANCE_TEMPLATE_NAME,
Expand Down Expand Up @@ -729,7 +729,7 @@ describe('Compute', () => {

it('should have created the right rule', async () => {
const target = [
'https://www.googleapis.com/compute/v1/global/targetHttpProxies/',
'https://compute.googleapis.com/compute/v1/global/targetHttpProxies/',
TARGET_PROXY_NAME,
].join('');

Expand All @@ -746,7 +746,8 @@ describe('Compute', () => {

it('should set a new target', async () => {
let target = [
'https://www.googleapis.com/compute/v1/projects/' + compute.projectId,
'https://compute.googleapis.com/compute/v1/projects/' +
compute.projectId,
'/global/targetHttpProxies/' + TARGET_PROXY_NAME,
].join('');

Expand Down Expand Up @@ -789,7 +790,8 @@ describe('Compute', () => {

it('should have created the right rule', async () => {
let target = [
'https://www.googleapis.com/compute/v1/projects/' + compute.projectId,
'https://compute.googleapis.com/compute/v1/projects/' +
compute.projectId,
'/zones/' + zone.name + '/targetInstances/' + TARGET_INSTANCE_NAME,
].join('');

Expand Down Expand Up @@ -998,7 +1000,7 @@ describe('Compute', () => {
await vm.resize(machineType);
const [metadata] = await vm.getMetadata();
const expectedMachineType = [
'https://www.googleapis.com/compute/v1',
'https://compute.googleapis.com/compute/v1',
'zones',
zone.id,
'machineTypes',
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('Compute', function() {

const calledWith = compute.calledWith_[0];

const baseUrl = 'https://www.googleapis.com/compute/v1';
const baseUrl = 'https://compute.googleapis.com/compute/v1';
assert.strictEqual(calledWith.baseUrl, baseUrl);
assert.deepStrictEqual(calledWith.scopes, [
'https://www.googleapis.com/auth/compute',
Expand Down
6 changes: 3 additions & 3 deletions test/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Service', function() {
const COMPUTE = {
projectId: 'project-id',
createService: util.noop,
apiEndpoint: 'www.googleapis.com',
apiEndpoint: 'compute.googleapis.com',
};

before(function() {
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('Service', function() {
service.request = function(reqOpts) {
assert.deepStrictEqual(reqOpts.json, {
group: [
'https://www.googleapis.com/compute/v1/projects/',
'https://compute.googleapis.com/compute/v1/projects/',
bcoe marked this conversation as resolved.
Show resolved Hide resolved
COMPUTE.projectId,
'/zones/',
group.zone,
Expand All @@ -231,7 +231,7 @@ describe('Service', function() {
service.request = function(reqOpts) {
assert.deepStrictEqual(reqOpts.json, {
group: [
'https://www.googleapis.com/compute/v1/projects/',
'https://compute.googleapis.com/compute/v1/projects/',
bcoe marked this conversation as resolved.
Show resolved Hide resolved
COMPUTE.projectId,
'/zones/',
group.zone.name,
Expand Down
4 changes: 2 additions & 2 deletions test/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Snapshot', function() {
let snapshot;

const COMPUTE = {
apiEndpoint: 'www.googleapis.com',
apiEndpoint: 'compute.googleapis.com',
};
const SNAPSHOT_NAME = 'snapshot-name';

Expand Down Expand Up @@ -74,7 +74,7 @@ describe('Snapshot', function() {
assert.strictEqual(calledWith.parent, COMPUTE);
assert.strictEqual(
calledWith.baseUrl,
'https://www.googleapis.com/compute/v1/projects/{{projectId}}/global/snapshots'
'https://compute.googleapis.com/compute/v1/projects/{{projectId}}/global/snapshots'
);
assert.strictEqual(calledWith.id, SNAPSHOT_NAME);
assert.deepStrictEqual(calledWith.methods, {
Expand Down
4 changes: 2 additions & 2 deletions test/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('VM', function() {
},
},
projectId: 'project-id',
apiEndpoint: 'www.googleapis.com',
apiEndpoint: 'compute.googleapis.com',
};
const ZONE = {
compute: COMPUTE,
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('VM', function() {
assert.strictEqual(
vm.url,
[
'https://www.googleapis.com/compute/v1/projects',
bcoe marked this conversation as resolved.
Show resolved Hide resolved
'https://compute.googleapis.com/compute/v1/projects',
COMPUTE.projectId,
'zones',
ZONE.name,
Expand Down