Skip to content

Commit

Permalink
fix: DEADLINE_EXCEEDED no longer listed as idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and bcoe committed May 8, 2019
1 parent 125b356 commit 473d145
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 97 deletions.
10 changes: 6 additions & 4 deletions .kokoro/lint.sh
Expand Up @@ -23,9 +23,11 @@ cd $(dirname $0)/..
npm install

# Install and link samples
cd samples/
npm link ../
npm install
cd ..
if [ -f samples/package.json ]; then
cd samples/
npm link ../
npm install
cd ..
fi

npm run lint
16 changes: 9 additions & 7 deletions .kokoro/samples-test.sh
Expand Up @@ -31,12 +31,14 @@ if [ -f .kokoro/pre-samples-test.sh ]; then
set -x
fi

npm install
if [ -f samples/package.json ]; then
npm install

# Install and link samples
cd samples/
npm link ../
npm install
cd ..
# Install and link samples
cd samples/
npm link ../
npm install
cd ..

npm run samples-test
npm run samples-test
fi
12 changes: 10 additions & 2 deletions .kokoro/test.sh
Expand Up @@ -22,6 +22,14 @@ cd $(dirname $0)/..

npm install
npm test
./node_modules/nyc/bin/nyc.js report

bash $KOKORO_GFILE_DIR/codecov.sh
COVERAGE_NODE=10
if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then
NYC_BIN=./node_modules/nyc/bin/nyc.js
if [ -f "$NYC_BIN" ]; then
$NYC_BIN report
fi
bash $KOKORO_GFILE_DIR/codecov.sh
else
echo "coverage is only reported for Node $COVERAGE_NODE"
fi
70 changes: 35 additions & 35 deletions src/v2/config_service_v2_client.js
Expand Up @@ -101,11 +101,11 @@ class ConfigServiceV2Client {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
sinkPathTemplate: new gax.PathTemplate('projects/{project}/sinks/{sink}'),
exclusionPathTemplate: new gax.PathTemplate(
'projects/{project}/exclusions/{exclusion}'
),
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
sinkPathTemplate: new gax.PathTemplate('projects/{project}/sinks/{sink}'),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -1121,6 +1121,20 @@ class ConfigServiceV2Client {
// -- Path templates --
// --------------------

/**
* Return a fully-qualified exclusion resource name string.
*
* @param {String} project
* @param {String} exclusion
* @returns {String}
*/
exclusionPath(project, exclusion) {
return this._pathTemplates.exclusionPathTemplate.render({
project: project,
exclusion: exclusion,
});
}

/**
* Return a fully-qualified project resource name string.
*
Expand Down Expand Up @@ -1148,17 +1162,27 @@ class ConfigServiceV2Client {
}

/**
* Return a fully-qualified exclusion resource name string.
* Parse the exclusionName from a exclusion resource.
*
* @param {String} project
* @param {String} exclusion
* @returns {String}
* @param {String} exclusionName
* A fully-qualified path representing a exclusion resources.
* @returns {String} - A string representing the project.
*/
exclusionPath(project, exclusion) {
return this._pathTemplates.exclusionPathTemplate.render({
project: project,
exclusion: exclusion,
});
matchProjectFromExclusionName(exclusionName) {
return this._pathTemplates.exclusionPathTemplate.match(exclusionName)
.project;
}

/**
* Parse the exclusionName from a exclusion resource.
*
* @param {String} exclusionName
* A fully-qualified path representing a exclusion resources.
* @returns {String} - A string representing the exclusion.
*/
matchExclusionFromExclusionName(exclusionName) {
return this._pathTemplates.exclusionPathTemplate.match(exclusionName)
.exclusion;
}

/**
Expand Down Expand Up @@ -1193,30 +1217,6 @@ class ConfigServiceV2Client {
matchSinkFromSinkName(sinkName) {
return this._pathTemplates.sinkPathTemplate.match(sinkName).sink;
}

/**
* Parse the exclusionName from a exclusion resource.
*
* @param {String} exclusionName
* A fully-qualified path representing a exclusion resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromExclusionName(exclusionName) {
return this._pathTemplates.exclusionPathTemplate.match(exclusionName)
.project;
}

/**
* Parse the exclusionName from a exclusion resource.
*
* @param {String} exclusionName
* A fully-qualified path representing a exclusion resources.
* @returns {String} - A string representing the exclusion.
*/
matchExclusionFromExclusionName(exclusionName) {
return this._pathTemplates.exclusionPathTemplate.match(exclusionName)
.exclusion;
}
}

module.exports = ConfigServiceV2Client;
1 change: 0 additions & 1 deletion src/v2/config_service_v2_client_config.json
Expand Up @@ -3,7 +3,6 @@
"google.logging.v2.ConfigServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
Expand Down
37 changes: 16 additions & 21 deletions src/v2/doc/google/api/doc_monitored_resource.js
Expand Up @@ -16,10 +16,9 @@
// to be loaded as the JS file.

/**
* An object that describes the schema of a
* MonitoredResource object using a type name
* and a set of labels. For example, the monitored resource descriptor for
* Google Compute Engine VM instances has a type of
* An object that describes the schema of a MonitoredResource object using a
* type name and a set of labels. For example, the monitored resource
* descriptor for Google Compute Engine VM instances has a type of
* `"gce_instance"` and specifies the use of the labels `"instance_id"` and
* `"zone"` to identify particular VM instances.
*
Expand Down Expand Up @@ -69,13 +68,11 @@ const MonitoredResourceDescriptor = {
* An object representing a resource that can be used for monitoring, logging,
* billing, or other purposes. Examples include virtual machine instances,
* databases, and storage devices such as disks. The `type` field identifies a
* MonitoredResourceDescriptor object
* that describes the resource's schema. Information in the `labels` field
* identifies the actual resource and its attributes according to the schema.
* For example, a particular Compute Engine VM instance could be represented by
* the following object, because the
* MonitoredResourceDescriptor for
* `"gce_instance"` has labels
* MonitoredResourceDescriptor object that describes the resource's
* schema. Information in the `labels` field identifies the actual resource and
* its attributes according to the schema. For example, a particular Compute
* Engine VM instance could be represented by the following object, because the
* MonitoredResourceDescriptor for `"gce_instance"` has labels
* `"instance_id"` and `"zone"`:
*
* { "type": "gce_instance",
Expand All @@ -84,10 +81,8 @@ const MonitoredResourceDescriptor = {
*
* @property {string} type
* Required. The monitored resource type. This field must match
* the `type` field of a
* MonitoredResourceDescriptor
* object. For example, the type of a Compute Engine VM instance is
* `gce_instance`.
* the `type` field of a MonitoredResourceDescriptor object. For
* example, the type of a Compute Engine VM instance is `gce_instance`.
*
* @property {Object.<string, string>} labels
* Required. Values for all of the labels listed in the associated monitored
Expand All @@ -103,12 +98,12 @@ const MonitoredResource = {
};

/**
* Auxiliary metadata for a MonitoredResource
* object. MonitoredResource objects contain the
* minimum set of information to uniquely identify a monitored resource
* instance. There is some other useful auxiliary metadata. Monitoring and
* Logging use an ingestion pipeline to extract metadata for cloud resources of
* all types, and store the metadata in this message.
* Auxiliary metadata for a MonitoredResource object.
* MonitoredResource objects contain the minimum set of information to
* uniquely identify a monitored resource instance. There is some other useful
* auxiliary metadata. Monitoring and Logging use an ingestion
* pipeline to extract metadata for cloud resources of all types, and store
* the metadata in this message.
*
* @property {Object} systemLabels
* Output only. Values for predefined system metadata labels.
Expand Down
1 change: 0 additions & 1 deletion src/v2/logging_service_v2_client_config.json
Expand Up @@ -3,7 +3,6 @@
"google.logging.v2.LoggingServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
Expand Down
38 changes: 19 additions & 19 deletions src/v2/metrics_service_v2_client.js
Expand Up @@ -100,10 +100,10 @@ class MetricsServiceV2Client {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
metricPathTemplate: new gax.PathTemplate(
'projects/{project}/metrics/{metric}'
),
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -607,18 +607,6 @@ class MetricsServiceV2Client {
// -- Path templates --
// --------------------

/**
* Return a fully-qualified project resource name string.
*
* @param {String} project
* @returns {String}
*/
projectPath(project) {
return this._pathTemplates.projectPathTemplate.render({
project: project,
});
}

/**
* Return a fully-qualified metric resource name string.
*
Expand All @@ -634,14 +622,15 @@ class MetricsServiceV2Client {
}

/**
* Parse the projectName from a project resource.
* Return a fully-qualified project resource name string.
*
* @param {String} projectName
* A fully-qualified path representing a project resources.
* @returns {String} - A string representing the project.
* @param {String} project
* @returns {String}
*/
matchProjectFromProjectName(projectName) {
return this._pathTemplates.projectPathTemplate.match(projectName).project;
projectPath(project) {
return this._pathTemplates.projectPathTemplate.render({
project: project,
});
}

/**
Expand All @@ -665,6 +654,17 @@ class MetricsServiceV2Client {
matchMetricFromMetricName(metricName) {
return this._pathTemplates.metricPathTemplate.match(metricName).metric;
}

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

module.exports = MetricsServiceV2Client;
1 change: 0 additions & 1 deletion src/v2/metrics_service_v2_client_config.json
Expand Up @@ -3,7 +3,6 @@
"google.logging.v2.MetricsServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
Expand Down
12 changes: 6 additions & 6 deletions synth.metadata
@@ -1,26 +1,26 @@
{
"updateTime": "2019-04-21T11:47:20.841946Z",
"updateTime": "2019-05-08T12:03:04.701437Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.16.26",
"dockerImage": "googleapis/artman@sha256:314eae2a40f6f7822db77365cf5f45bd513d628ae17773fd0473f460e7c2a665"
"version": "0.19.0",
"dockerImage": "googleapis/artman@sha256:d3df563538225ac6caac45d8ad86499500211d1bcb2536955a6dbda15e1b368e"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "3369c803f56d52662ea3792076deb8545183bdb0",
"internalRef": "244282812"
"sha": "51145ff7812d2bb44c1219d0b76dac92a8bd94b2",
"internalRef": "247143125"
}
},
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.4.10"
"version": "2019.5.2"
}
}
],
Expand Down

0 comments on commit 473d145

Please sign in to comment.