Skip to content

Commit

Permalink
Regenerate logging API clients. (#1870)
Browse files Browse the repository at this point in the history
This regeneration is for googleapis/googleapis#208.

Basically, it changes the name of 'parentPath' to 'projectPath',
and we believe the new name is more understandable.

This regeneration happens to include a minor change on the codegen
to support LRO -- however this does not require any updates on
dependencies. Simple style changes.
  • Loading branch information
jmuk authored and stephenplusplus committed Dec 8, 2016
1 parent 8985941 commit 14224a3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 48 deletions.
31 changes: 14 additions & 17 deletions src/v2/config_service_v2_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function ConfigServiceV2Client(gaxGrpc, grpcClients, opts) {
var configServiceV2Stub = gaxGrpc.createStub(
servicePath,
port,
grpcClients.configServiceV2Client.google.logging.v2.ConfigServiceV2,
grpcClients.google.logging.v2.ConfigServiceV2,
{sslCreds: sslCreds});
var configServiceV2StubMethods = [
'listSinks',
Expand All @@ -117,31 +117,31 @@ function ConfigServiceV2Client(gaxGrpc, grpcClients, opts) {

// Path templates

var PARENT_PATH_TEMPLATE = new gax.PathTemplate(
var PROJECT_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}');

var SINK_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}/sinks/{sink}');

/**
* Returns a fully-qualified parent resource name string.
* Returns a fully-qualified project resource name string.
* @param {String} project
* @returns {String}
*/
ConfigServiceV2Client.prototype.parentPath = function(project) {
return PARENT_PATH_TEMPLATE.render({
ConfigServiceV2Client.prototype.projectPath = function(project) {
return PROJECT_PATH_TEMPLATE.render({
project: project
});
};

/**
* Parses the parentName from a parent resource.
* @param {String} parentName
* A fully-qualified path representing a parent resources.
* Parses the projectName from a project resource.
* @param {String} projectName
* A fully-qualified path representing a project resources.
* @returns {String} - A string representing the project.
*/
ConfigServiceV2Client.prototype.matchProjectFromParentName = function(parentName) {
return PARENT_PATH_TEMPLATE.match(parentName).project;
ConfigServiceV2Client.prototype.matchProjectFromProjectName = function(projectName) {
return PROJECT_PATH_TEMPLATE.match(projectName).project;
};

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ ConfigServiceV2Client.prototype.matchSinkFromSinkName = function(sinkName) {
* @example
*
* var client = loggingV2.configServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* // Iterate over all elements.
* client.listSinks({parent: formattedParent}).then(function(responses) {
* var resources = responses[0];
Expand Down Expand Up @@ -302,7 +302,7 @@ ConfigServiceV2Client.prototype.listSinks = function(request, options, callback)
* @example
*
* var client = loggingV2.configServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* client.listSinksStream({parent: formattedParent}).on('data', function(element) {
* // doThingsWith(element)
* }).on('error', function(err) {
Expand Down Expand Up @@ -396,7 +396,7 @@ ConfigServiceV2Client.prototype.getSink = function(request, options, callback) {
* @example
*
* var client = loggingV2.configServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* var sink = {};
* var request = {
* parent: formattedParent,
Expand Down Expand Up @@ -537,9 +537,6 @@ function ConfigServiceV2ClientBuilder(gaxGrpc) {
}]);
extend(this, configServiceV2Client.google.logging.v2);

var grpcClients = {
configServiceV2Client: configServiceV2Client
};

/**
* Build a new instance of {@link ConfigServiceV2Client}.
Expand All @@ -560,7 +557,7 @@ function ConfigServiceV2ClientBuilder(gaxGrpc) {
* The version of the calling service.
*/
this.configServiceV2Client = function(opts) {
return new ConfigServiceV2Client(gaxGrpc, grpcClients, opts);
return new ConfigServiceV2Client(gaxGrpc, configServiceV2Client, opts);
};
extend(this.configServiceV2Client, ConfigServiceV2Client);
}
Expand Down
25 changes: 11 additions & 14 deletions src/v2/logging_service_v2_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function LoggingServiceV2Client(gaxGrpc, grpcClients, opts) {
var loggingServiceV2Stub = gaxGrpc.createStub(
servicePath,
port,
grpcClients.loggingServiceV2Client.google.logging.v2.LoggingServiceV2,
grpcClients.google.logging.v2.LoggingServiceV2,
{sslCreds: sslCreds});
var loggingServiceV2StubMethods = [
'deleteLog',
Expand All @@ -119,31 +119,31 @@ function LoggingServiceV2Client(gaxGrpc, grpcClients, opts) {

// Path templates

var PARENT_PATH_TEMPLATE = new gax.PathTemplate(
var PROJECT_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}');

var LOG_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}/logs/{log}');

/**
* Returns a fully-qualified parent resource name string.
* Returns a fully-qualified project resource name string.
* @param {String} project
* @returns {String}
*/
LoggingServiceV2Client.prototype.parentPath = function(project) {
return PARENT_PATH_TEMPLATE.render({
LoggingServiceV2Client.prototype.projectPath = function(project) {
return PROJECT_PATH_TEMPLATE.render({
project: project
});
};

/**
* Parses the parentName from a parent resource.
* @param {String} parentName
* A fully-qualified path representing a parent resources.
* Parses the projectName from a project resource.
* @param {String} projectName
* A fully-qualified path representing a project resources.
* @returns {String} - A string representing the project.
*/
LoggingServiceV2Client.prototype.matchProjectFromParentName = function(parentName) {
return PARENT_PATH_TEMPLATE.match(parentName).project;
LoggingServiceV2Client.prototype.matchProjectFromProjectName = function(projectName) {
return PROJECT_PATH_TEMPLATE.match(projectName).project;
};

/**
Expand Down Expand Up @@ -633,9 +633,6 @@ function LoggingServiceV2ClientBuilder(gaxGrpc) {
}]);
extend(this, loggingServiceV2Client.google.logging.v2);

var grpcClients = {
loggingServiceV2Client: loggingServiceV2Client
};

/**
* Build a new instance of {@link LoggingServiceV2Client}.
Expand All @@ -656,7 +653,7 @@ function LoggingServiceV2ClientBuilder(gaxGrpc) {
* The version of the calling service.
*/
this.loggingServiceV2Client = function(opts) {
return new LoggingServiceV2Client(gaxGrpc, grpcClients, opts);
return new LoggingServiceV2Client(gaxGrpc, loggingServiceV2Client, opts);
};
extend(this.loggingServiceV2Client, LoggingServiceV2Client);
}
Expand Down
31 changes: 14 additions & 17 deletions src/v2/metrics_service_v2_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function MetricsServiceV2Client(gaxGrpc, grpcClients, opts) {
var metricsServiceV2Stub = gaxGrpc.createStub(
servicePath,
port,
grpcClients.metricsServiceV2Client.google.logging.v2.MetricsServiceV2,
grpcClients.google.logging.v2.MetricsServiceV2,
{sslCreds: sslCreds});
var metricsServiceV2StubMethods = [
'listLogMetrics',
Expand All @@ -116,31 +116,31 @@ function MetricsServiceV2Client(gaxGrpc, grpcClients, opts) {

// Path templates

var PARENT_PATH_TEMPLATE = new gax.PathTemplate(
var PROJECT_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}');

var METRIC_PATH_TEMPLATE = new gax.PathTemplate(
'projects/{project}/metrics/{metric}');

/**
* Returns a fully-qualified parent resource name string.
* Returns a fully-qualified project resource name string.
* @param {String} project
* @returns {String}
*/
MetricsServiceV2Client.prototype.parentPath = function(project) {
return PARENT_PATH_TEMPLATE.render({
MetricsServiceV2Client.prototype.projectPath = function(project) {
return PROJECT_PATH_TEMPLATE.render({
project: project
});
};

/**
* Parses the parentName from a parent resource.
* @param {String} parentName
* A fully-qualified path representing a parent resources.
* Parses the projectName from a project resource.
* @param {String} projectName
* A fully-qualified path representing a project resources.
* @returns {String} - A string representing the project.
*/
MetricsServiceV2Client.prototype.matchProjectFromParentName = function(parentName) {
return PARENT_PATH_TEMPLATE.match(parentName).project;
MetricsServiceV2Client.prototype.matchProjectFromProjectName = function(projectName) {
return PROJECT_PATH_TEMPLATE.match(projectName).project;
};

/**
Expand Down Expand Up @@ -219,7 +219,7 @@ MetricsServiceV2Client.prototype.matchMetricFromMetricName = function(metricName
* @example
*
* var client = loggingV2.metricsServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* // Iterate over all elements.
* client.listLogMetrics({parent: formattedParent}).then(function(responses) {
* var resources = responses[0];
Expand Down Expand Up @@ -299,7 +299,7 @@ MetricsServiceV2Client.prototype.listLogMetrics = function(request, options, cal
* @example
*
* var client = loggingV2.metricsServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* client.listLogMetricsStream({parent: formattedParent}).on('data', function(element) {
* // doThingsWith(element)
* }).on('error', function(err) {
Expand Down Expand Up @@ -387,7 +387,7 @@ MetricsServiceV2Client.prototype.getLogMetric = function(request, options, callb
* @example
*
* var client = loggingV2.metricsServiceV2Client();
* var formattedParent = client.parentPath("[PROJECT]");
* var formattedParent = client.projectPath("[PROJECT]");
* var metric = {};
* var request = {
* parent: formattedParent,
Expand Down Expand Up @@ -516,9 +516,6 @@ function MetricsServiceV2ClientBuilder(gaxGrpc) {
}]);
extend(this, metricsServiceV2Client.google.logging.v2);

var grpcClients = {
metricsServiceV2Client: metricsServiceV2Client
};

/**
* Build a new instance of {@link MetricsServiceV2Client}.
Expand All @@ -539,7 +536,7 @@ function MetricsServiceV2ClientBuilder(gaxGrpc) {
* The version of the calling service.
*/
this.metricsServiceV2Client = function(opts) {
return new MetricsServiceV2Client(gaxGrpc, grpcClients, opts);
return new MetricsServiceV2Client(gaxGrpc, metricsServiceV2Client, opts);
};
extend(this.metricsServiceV2Client, MetricsServiceV2Client);
}
Expand Down

0 comments on commit 14224a3

Please sign in to comment.