Skip to content

Commit

Permalink
chore: re-order template utils (#151)
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 56c0a88 commit 83f4a58
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 73 deletions.
68 changes: 34 additions & 34 deletions packages/google-cloud-redis/src/v1/cloud_redis_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ class CloudRedisClient {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
locationPathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}'
),
instancePathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}/instances/{instance}'
),
locationPathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}'
),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -1052,58 +1052,35 @@ class CloudRedisClient {
// --------------------

/**
* Return a fully-qualified location resource name string.
* Return a fully-qualified instance resource name string.
*
* @param {String} project
* @param {String} location
* @param {String} instance
* @returns {String}
*/
locationPath(project, location) {
return this._pathTemplates.locationPathTemplate.render({
instancePath(project, location, instance) {
return this._pathTemplates.instancePathTemplate.render({
project: project,
location: location,
instance: instance,
});
}

/**
* Return a fully-qualified instance resource name string.
* Return a fully-qualified location resource name string.
*
* @param {String} project
* @param {String} location
* @param {String} instance
* @returns {String}
*/
instancePath(project, location, instance) {
return this._pathTemplates.instancePathTemplate.render({
locationPath(project, location) {
return this._pathTemplates.locationPathTemplate.render({
project: project,
location: location,
instance: instance,
});
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the location.
*/
matchLocationFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName)
.location;
}

/**
* Parse the instanceName from a instance resource.
*
Expand Down Expand Up @@ -1138,6 +1115,29 @@ class CloudRedisClient {
return this._pathTemplates.instancePathTemplate.match(instanceName)
.instance;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the location.
*/
matchLocationFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName)
.location;
}
}

module.exports = CloudRedisClient;
68 changes: 34 additions & 34 deletions packages/google-cloud-redis/src/v1beta1/cloud_redis_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ class CloudRedisClient {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
locationPathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}'
),
instancePathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}/instances/{instance}'
),
locationPathTemplate: new gax.PathTemplate(
'projects/{project}/locations/{location}'
),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -1046,58 +1046,35 @@ class CloudRedisClient {
// --------------------

/**
* Return a fully-qualified location resource name string.
* Return a fully-qualified instance resource name string.
*
* @param {String} project
* @param {String} location
* @param {String} instance
* @returns {String}
*/
locationPath(project, location) {
return this._pathTemplates.locationPathTemplate.render({
instancePath(project, location, instance) {
return this._pathTemplates.instancePathTemplate.render({
project: project,
location: location,
instance: instance,
});
}

/**
* Return a fully-qualified instance resource name string.
* Return a fully-qualified location resource name string.
*
* @param {String} project
* @param {String} location
* @param {String} instance
* @returns {String}
*/
instancePath(project, location, instance) {
return this._pathTemplates.instancePathTemplate.render({
locationPath(project, location) {
return this._pathTemplates.locationPathTemplate.render({
project: project,
location: location,
instance: instance,
});
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the location.
*/
matchLocationFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName)
.location;
}

/**
* Parse the instanceName from a instance resource.
*
Expand Down Expand Up @@ -1132,6 +1109,29 @@ class CloudRedisClient {
return this._pathTemplates.instancePathTemplate.match(instanceName)
.instance;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the locationName from a location resource.
*
* @param {String} locationName
* A fully-qualified path representing a location resources.
* @returns {String} - A string representing the location.
*/
matchLocationFromLocationName(locationName) {
return this._pathTemplates.locationPathTemplate.match(locationName)
.location;
}
}

module.exports = CloudRedisClient;
10 changes: 5 additions & 5 deletions packages/google-cloud-redis/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-04-21T11:50:32.433585Z",
"updateTime": "2019-04-23T11:18:11.361592Z",
"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 83f4a58

Please sign in to comment.