diff --git a/README.md b/README.md index a5f4373..366bcd6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ images.getAll((err, images) => { [ { kind: 'compute#image', - selfLink: 'https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20150710', + selfLink: 'https://compute.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20150710', id: '2223645373384728207', creationTimestamp: '2015-07-13T13:32:32.483-07:00', name: 'centos-6-v20150710', @@ -60,7 +60,7 @@ images.getLatest('ubuntu', (err, image) => { /* image = { kind: 'compute#image', - selfLink: 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1504-vivid-v20150616a', + selfLink: 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1504-vivid-v20150616a', id: '6610082300127119636', creationTimestamp: '2015-06-17T02:03:55.825-07:00', name: 'ubuntu-1504-vivid-v20150616a', @@ -71,7 +71,7 @@ images.getLatest('ubuntu', (err, image) => { archiveSizeBytes: '806558757', diskSizeGb: '10', licenses: [ - 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1504-vivid' + 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1504-vivid' ] } */ @@ -85,7 +85,7 @@ images.getLatest('your-project-id-or-name/ubuntu', (err, image) => { /* image = { kind: 'compute#image', - selfLink: 'https://www.googleapis.com/compute/v1/projects/your-project-id-or-name/global/images/ubuntu-1504-vivid-v20150616a', + selfLink: 'https://compute.googleapis.com/compute/v1/projects/your-project-id-or-name/global/images/ubuntu-1504-vivid-v20150616a', id: '6610082300127119636', creationTimestamp: '2015-06-17T02:03:55.825-07:00', name: 'ubuntu-1504-vivid-v20150616a', @@ -96,7 +96,7 @@ images.getLatest('your-project-id-or-name/ubuntu', (err, image) => { archiveSizeBytes: '806558757', diskSizeGb: '10', licenses: [ - 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1504-vivid' + 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1504-vivid' ] } */ @@ -110,7 +110,7 @@ images.getLatest('ubuntu-1404', (err, image) => { /* image = { kind: 'compute#image', - selfLink: 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1410-utopic-v20150625', + selfLink: 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1410-utopic-v20150625', id: '7075003915689987469', creationTimestamp: '2015-07-09T10:46:10.424-07:00', name: 'ubuntu-1410-utopic-v20150625', @@ -121,7 +121,7 @@ images.getLatest('ubuntu-1404', (err, image) => { archiveSizeBytes: '752874399', diskSizeGb: '10', licenses: [ - 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1410-utopic' + 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1410-utopic' ] } */ @@ -134,15 +134,15 @@ images.getLatest('ubuntu-1404', (err, image) => { images.OS_URLS; // also available on require('gce-images').OS_URLS; /* { - centos: 'https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images', - 'container-vm': 'https://www.googleapis.com/compute/v1/projects/cos-cloud/global/images', - coreos: 'https://www.googleapis.com/compute/v1/projects/coreos-cloud/global/images', - debian: 'https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images', - redhat: 'https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/images', - opensuse: 'https://www.googleapis.com/compute/v1/projects/opensuse-cloud/global/images', - suse: 'https://www.googleapis.com/compute/v1/projects/suse-cloud/global/images', - ubuntu: 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images', - windows: 'https://www.googleapis.com/compute/v1/projects/windows-cloud/global/images' + centos: 'https://compute.googleapis.com/compute/v1/projects/centos-cloud/global/images', + 'container-vm': 'https://compute.googleapis.com/compute/v1/projects/cos-cloud/global/images', + coreos: 'https://compute.googleapis.com/compute/v1/projects/coreos-cloud/global/images', + debian: 'https://compute.googleapis.com/compute/v1/projects/debian-cloud/global/images', + redhat: 'https://compute.googleapis.com/compute/v1/projects/rhel-cloud/global/images', + opensuse: 'https://compute.googleapis.com/compute/v1/projects/opensuse-cloud/global/images', + suse: 'https://compute.googleapis.com/compute/v1/projects/suse-cloud/global/images', + ubuntu: 'https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images', + windows: 'https://compute.googleapis.com/compute/v1/projects/windows-cloud/global/images' } */ ``` diff --git a/package.json b/package.json index 6cd7bcc..260b07c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "google-auth-library": "^5.0.0" }, "devDependencies": { - "@compodoc/compodoc": "^1.1.9", + "@compodoc/compodoc": "^1.1.10", "@types/chai": "^4.1.7", "@types/mocha": "^5.2.5", "@types/node": "^10.5.6", diff --git a/src/index.ts b/src/index.ts index 67d9adb..061e1ff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ export interface GCEImagesConfig extends GoogleAuthOptions { authClient?: GoogleAuth; /** * The host name used to access the compute API. - * Defaults to `www.googleapis.com`. + * Defaults to `compute.googleapis.com`. */ apiEndpoint?: string; } @@ -76,7 +76,7 @@ export class GCEImages { OS_URLS: OSUrls; OS_TO_URL: {[index: string]: string}; constructor(config: GCEImagesConfig = {}) { - this.apiEndpoint = config.apiEndpoint || 'www.googleapis.com'; + this.apiEndpoint = config.apiEndpoint || 'compute.googleapis.com'; config.scopes = ['https://www.googleapis.com/auth/compute']; this._auth = config.authClient || new GoogleAuth(config); const projectsPath = `https://${this.apiEndpoint}/compute/v1/projects`; @@ -320,7 +320,7 @@ export class GCEImages { } if (hasProject) { - osParts.url = `https://www.googleapis.com/compute/v1/projects/${project!}/global/images`; + osParts.url = `https://compute.googleapis.com/compute/v1/projects/${project!}/global/images`; } else { osParts.url = this.OS_TO_URL[osParts.name]; }