Skip to content
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

chore: use gcp-metadata #278

Merged
merged 6 commits into from
Feb 8, 2018
Merged

chore: use gcp-metadata #278

merged 6 commits into from
Feb 8, 2018

Conversation

JustinBeckwith
Copy link
Contributor

First draft of integrating the new and shiny gcp-metadata. First googleapis/gcp-metadata#24 needs to land, and we need to ship it :)

Resolves #190.

@JustinBeckwith JustinBeckwith requested review from ofrobots and a team February 3, 2018 23:53
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 3, 2018
package.json Outdated
@@ -21,6 +21,7 @@
],
"dependencies": {
"axios": "^0.17.1",
"gcp-metadata": "^0.4.1",

This comment was marked as spam.

This comment was marked as spam.

@@ -15,7 +15,7 @@
*/

import {AxiosError, AxiosPromise, AxiosRequestConfig, AxiosResponse} from 'axios';

import * as gcpMetadata from 'gcp-metadata';

This comment was marked as spam.

}
this.checkIsGCE = false;
}
this.checkIsGCE = await gcpMetadata.isAvailable();

This comment was marked as spam.

'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/?recursive=true',
headers: {'Metadata-Flavor': 'Google'}
});
const res = await gcpMetadata.instance(

This comment was marked as spam.

'metadata-flavor': 'Google'
});
const host = gcpMetadata.HOST_ADDRESS;
const instancePath = '/computeMetadata/v1beta1/instance';

This comment was marked as spam.

@@ -60,11 +61,15 @@ export class Compute extends OAuth2Client {
*/
protected async refreshToken(refreshToken?: string|
null): Promise<GetTokenResponse> {
const url = this.tokenUrl || Compute._GOOGLE_OAUTH2_TOKEN_URL;
const url =

This comment was marked as spam.

@codecov-io
Copy link

codecov-io commented Feb 7, 2018

Codecov Report

Merging #278 into master will increase coverage by 0.31%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #278      +/-   ##
==========================================
+ Coverage   91.33%   91.64%   +0.31%     
==========================================
  Files          13       13              
  Lines         842      826      -16     
  Branches      185      177       -8     
==========================================
- Hits          769      757      -12     
+ Misses         73       69       -4
Impacted Files Coverage Δ
src/auth/computeclient.ts 95% <100%> (+0.26%) ⬆️
src/auth/googleauth.ts 85.25% <87.5%> (+0.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a21d244...92c463b. Read the comment docs.

@JustinBeckwith
Copy link
Contributor Author

@ofrobots this is ready for a look 🎉

Copy link
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w/ nits

package.json Outdated
@@ -21,6 +21,7 @@
],
"dependencies": {
"axios": "^0.17.1",
"gcp-metadata": "^0.4.1",

This comment was marked as spam.

}
this.checkIsGCE = false;
}
this.checkIsGCE = await gcpMetadata.isAvailable();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@JustinBeckwith JustinBeckwith merged commit 3c9efe5 into googleapis:master Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants