Skip to content

Commit

Permalink
chore: re-order template utils (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Apr 23, 2019
1 parent b71032f commit e957e74
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
70 changes: 35 additions & 35 deletions packages/google-cloud-oslogin/src/v1beta/os_login_service_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ class OsLoginServiceClient {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
userPathTemplate: new gax.PathTemplate('users/{user}'),
projectPathTemplate: new gax.PathTemplate(
'users/{user}/projects/{project}'
),
fingerprintPathTemplate: new gax.PathTemplate(
'users/{user}/sshPublicKeys/{fingerprint}'
),
projectPathTemplate: new gax.PathTemplate(
'users/{user}/projects/{project}'
),
userPathTemplate: new gax.PathTemplate('users/{user}'),
};

// Put together the default options sent with requests.
Expand Down Expand Up @@ -544,14 +544,16 @@ class OsLoginServiceClient {
// --------------------

/**
* Return a fully-qualified user resource name string.
* Return a fully-qualified fingerprint resource name string.
*
* @param {String} user
* @param {String} fingerprint
* @returns {String}
*/
userPath(user) {
return this._pathTemplates.userPathTemplate.render({
fingerprintPath(user, fingerprint) {
return this._pathTemplates.fingerprintPathTemplate.render({
user: user,
fingerprint: fingerprint,
});
}

Expand All @@ -570,28 +572,39 @@ class OsLoginServiceClient {
}

/**
* Return a fully-qualified fingerprint resource name string.
* Return a fully-qualified user resource name string.
*
* @param {String} user
* @param {String} fingerprint
* @returns {String}
*/
fingerprintPath(user, fingerprint) {
return this._pathTemplates.fingerprintPathTemplate.render({
userPath(user) {
return this._pathTemplates.userPathTemplate.render({
user: user,
fingerprint: fingerprint,
});
}

/**
* Parse the userName from a user resource.
* Parse the fingerprintName from a fingerprint resource.
*
* @param {String} userName
* A fully-qualified path representing a user resources.
* @param {String} fingerprintName
* A fully-qualified path representing a fingerprint resources.
* @returns {String} - A string representing the user.
*/
matchUserFromUserName(userName) {
return this._pathTemplates.userPathTemplate.match(userName).user;
matchUserFromFingerprintName(fingerprintName) {
return this._pathTemplates.fingerprintPathTemplate.match(fingerprintName)
.user;
}

/**
* Parse the fingerprintName from a fingerprint resource.
*
* @param {String} fingerprintName
* A fully-qualified path representing a fingerprint resources.
* @returns {String} - A string representing the fingerprint.
*/
matchFingerprintFromFingerprintName(fingerprintName) {
return this._pathTemplates.fingerprintPathTemplate.match(fingerprintName)
.fingerprint;
}

/**
Expand All @@ -617,27 +630,14 @@ class OsLoginServiceClient {
}

/**
* Parse the fingerprintName from a fingerprint resource.
* Parse the userName from a user resource.
*
* @param {String} fingerprintName
* A fully-qualified path representing a fingerprint resources.
* @param {String} userName
* A fully-qualified path representing a user resources.
* @returns {String} - A string representing the user.
*/
matchUserFromFingerprintName(fingerprintName) {
return this._pathTemplates.fingerprintPathTemplate.match(fingerprintName)
.user;
}

/**
* Parse the fingerprintName from a fingerprint resource.
*
* @param {String} fingerprintName
* A fully-qualified path representing a fingerprint resources.
* @returns {String} - A string representing the fingerprint.
*/
matchFingerprintFromFingerprintName(fingerprintName) {
return this._pathTemplates.fingerprintPathTemplate.match(fingerprintName)
.fingerprint;
matchUserFromUserName(userName) {
return this._pathTemplates.userPathTemplate.match(userName).user;
}
}

Expand Down
10 changes: 5 additions & 5 deletions packages/google-cloud-oslogin/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-04-21T11:48:42.204212Z",
"updateTime": "2019-04-23T11:16:25.036325Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.16.26",
"dockerImage": "googleapis/artman@sha256:314eae2a40f6f7822db77365cf5f45bd513d628ae17773fd0473f460e7c2a665"
"version": "0.17.0",
"dockerImage": "googleapis/artman@sha256:c58f4ec3838eb4e0718eb1bccc6512bd6850feaa85a360a9e38f6f848ec73bc2"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "3369c803f56d52662ea3792076deb8545183bdb0",
"internalRef": "244282812"
"sha": "547e19e7df398e9290e8e3674d7351efc500f9b0",
"internalRef": "244712781"
}
},
{
Expand Down

0 comments on commit e957e74

Please sign in to comment.