Skip to content

Commit

Permalink
fix: fixes for routing headers (#17)
Browse files Browse the repository at this point in the history
* fix: fixes for routing headers

Use gapic-generator-typescript v2.15.3.

Committer: @alexander-fenster
PiperOrigin-RevId: 462159384

Source-Link: googleapis/googleapis@ff8159e

Source-Link: googleapis/googleapis-gen@72d2f0f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzJkMmYwZmFhNDNkZTZmYTgxOTA5NGRhOTA3MGEzMDM2ZDdjYzNlMyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jul 20, 2022
1 parent cb5919f commit 77f9a46
Show file tree
Hide file tree
Showing 4 changed files with 464 additions and 158 deletions.
105 changes: 55 additions & 50 deletions packages/google-cloud-run/src/v2/revisions_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,18 @@ export class RevisionsClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.name !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.name!
)
) {
Object.assign(routingParameter, {
location: request.name!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.name;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -576,17 +577,18 @@ export class RevisionsClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.name !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.name!
)
) {
Object.assign(routingParameter, {
location: request.name!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.name;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -716,17 +718,18 @@ export class RevisionsClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -770,17 +773,18 @@ export class RevisionsClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
const defaultCallSettings = this._defaults['listRevisions'];
Expand Down Expand Up @@ -833,17 +837,18 @@ export class RevisionsClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
const defaultCallSettings = this._defaults['listRevisions'];
Expand Down
149 changes: 77 additions & 72 deletions packages/google-cloud-run/src/v2/services_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.name !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.name!
)
) {
Object.assign(routingParameter, {
location: request.name!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.name;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -875,17 +876,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -1029,19 +1031,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.service?.name !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.service?.name!
)
) {
Object.assign(routingParameter, {
location: request.service?.name!.match(
RegExp('(?<location>[^/]+)')
)![0],
});
{
const fieldValue = request.service?.name;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -1187,17 +1188,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.name !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?').test(
request.name!
)
) {
Object.assign(routingParameter, {
location: request.name!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.name;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -1326,17 +1328,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
this.initialize();
Expand Down Expand Up @@ -1379,17 +1382,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
const defaultCallSettings = this._defaults['listServices'];
Expand Down Expand Up @@ -1441,17 +1445,18 @@ export class ServicesClient {
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
const routingParameter = {};
if (
typeof request.parent !== 'undefined' &&
RegExp('projects/[^/]+/locations/(?<location>[^/]+)').test(
request.parent!
)
) {
Object.assign(routingParameter, {
location: request.parent!.match(RegExp('(?<location>[^/]+)'))![0],
});
{
const fieldValue = request.parent;
if (fieldValue !== undefined && fieldValue !== null) {
const match = fieldValue
.toString()
.match(RegExp('projects/[^/]+/locations/(?<location>[^/]+)'));
if (match) {
const parameterValue = match.groups?.['location'] ?? fieldValue;
Object.assign(routingParameter, {location: parameterValue});
}
}
}

options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams(routingParameter);
const defaultCallSettings = this._defaults['listServices'];
Expand Down
Loading

0 comments on commit 77f9a46

Please sign in to comment.