Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 878cd3f

Browse files
feat(spanner): add processing_units to Instance resource (#1398)
PiperOrigin-RevId: 378758342 Source-Link: googleapis/googleapis@d869871 Source-Link: googleapis/googleapis-gen@54cfa76
1 parent 4a73e29 commit 878cd3f

7 files changed

Lines changed: 53 additions & 63 deletions

File tree

protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ message Instance {
368368
// for more information about nodes.
369369
int32 node_count = 5;
370370

371+
// The number of processing units allocated to this instance. At most one of
372+
// processing_units or node_count should be present in the message. This may
373+
// be zero in API responses for instances that are not yet in state `READY`.
374+
int32 processing_units = 9;
375+
371376
// Output only. The current instance state. For
372377
// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], the state must be
373378
// either omitted or set to `CREATING`. For

protos/protos.d.ts

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/protos.js

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/protos.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/v1/database_admin_client.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import {
2727
PaginationCallback,
2828
GaxCall,
2929
} from 'google-gax';
30-
import * as path from 'path';
3130

3231
import {Transform} from 'stream';
3332
import {RequestType} from 'google-gax/build/src/apitypes';
3433
import * as protos from '../../protos/protos';
34+
import jsonProtos = require('../../protos/protos.json');
3535
/**
3636
* Client JSON configuration object, loaded from
3737
* `src/v1/database_admin_client_config.json`.
@@ -147,27 +147,14 @@ export class DatabaseAdminClient {
147147
}
148148
if (!opts.fallback) {
149149
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
150+
} else if (opts.fallback === 'rest') {
151+
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
150152
}
151153
if (opts.libName && opts.libVersion) {
152154
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
153155
}
154156
// Load the applicable protos.
155-
// For Node.js, pass the path to JSON proto file.
156-
// For browsers, pass the JSON content.
157-
158-
const nodejsProtoPath = path.join(
159-
__dirname,
160-
'..',
161-
'..',
162-
'protos',
163-
'protos.json'
164-
);
165-
this._protos = this._gaxGrpc.loadProto(
166-
opts.fallback
167-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
168-
require('../../protos/protos.json')
169-
: nodejsProtoPath
170-
);
157+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
171158

172159
// This API contains "path templates"; forward-slash-separated
173160
// identifiers to uniquely identify resources within the API.
@@ -213,15 +200,11 @@ export class DatabaseAdminClient {
213200
),
214201
};
215202

203+
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
204+
216205
// This API contains "long-running operations", which return a
217206
// an Operation object that allows for tracking of the operation,
218207
// rather than holding a request open.
219-
const protoFilesRoot = opts.fallback
220-
? this._gaxModule.protobuf.Root.fromJSON(
221-
// eslint-disable-next-line @typescript-eslint/no-var-requires
222-
require('../../protos/protos.json')
223-
)
224-
: this._gaxModule.protobuf.loadSync(nodejsProtoPath);
225208

226209
this.operationsClient = this._gaxModule
227210
.lro({

src/v1/instance_admin_client.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import {
2727
PaginationCallback,
2828
GaxCall,
2929
} from 'google-gax';
30-
import * as path from 'path';
3130

3231
import {Transform} from 'stream';
3332
import {RequestType} from 'google-gax/build/src/apitypes';
3433
import * as protos from '../../protos/protos';
34+
import jsonProtos = require('../../protos/protos.json');
3535
/**
3636
* Client JSON configuration object, loaded from
3737
* `src/v1/instance_admin_client_config.json`.
@@ -162,27 +162,14 @@ export class InstanceAdminClient {
162162
}
163163
if (!opts.fallback) {
164164
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
165+
} else if (opts.fallback === 'rest') {
166+
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
165167
}
166168
if (opts.libName && opts.libVersion) {
167169
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
168170
}
169171
// Load the applicable protos.
170-
// For Node.js, pass the path to JSON proto file.
171-
// For browsers, pass the JSON content.
172-
173-
const nodejsProtoPath = path.join(
174-
__dirname,
175-
'..',
176-
'..',
177-
'protos',
178-
'protos.json'
179-
);
180-
this._protos = this._gaxGrpc.loadProto(
181-
opts.fallback
182-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
183-
require('../../protos/protos.json')
184-
: nodejsProtoPath
185-
);
172+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
186173

187174
// This API contains "path templates"; forward-slash-separated
188175
// identifiers to uniquely identify resources within the API.
@@ -215,15 +202,11 @@ export class InstanceAdminClient {
215202
),
216203
};
217204

205+
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
206+
218207
// This API contains "long-running operations", which return a
219208
// an Operation object that allows for tracking of the operation,
220209
// rather than holding a request open.
221-
const protoFilesRoot = opts.fallback
222-
? this._gaxModule.protobuf.Root.fromJSON(
223-
// eslint-disable-next-line @typescript-eslint/no-var-requires
224-
require('../../protos/protos.json')
225-
)
226-
: this._gaxModule.protobuf.loadSync(nodejsProtoPath);
227210

228211
this.operationsClient = this._gaxModule
229212
.lro({

src/v1/spanner_client.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ import {
2626
PaginationCallback,
2727
GaxCall,
2828
} from 'google-gax';
29-
import * as path from 'path';
3029

3130
import {Transform} from 'stream';
3231
import {RequestType} from 'google-gax/build/src/apitypes';
3332
import * as protos from '../../protos/protos';
33+
import jsonProtos = require('../../protos/protos.json');
3434
/**
3535
* Client JSON configuration object, loaded from
3636
* `src/v1/spanner_client_config.json`.
@@ -143,27 +143,14 @@ export class SpannerClient {
143143
}
144144
if (!opts.fallback) {
145145
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
146+
} else if (opts.fallback === 'rest') {
147+
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
146148
}
147149
if (opts.libName && opts.libVersion) {
148150
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
149151
}
150152
// Load the applicable protos.
151-
// For Node.js, pass the path to JSON proto file.
152-
// For browsers, pass the JSON content.
153-
154-
const nodejsProtoPath = path.join(
155-
__dirname,
156-
'..',
157-
'..',
158-
'protos',
159-
'protos.json'
160-
);
161-
this._protos = this._gaxGrpc.loadProto(
162-
opts.fallback
163-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
164-
require('../../protos/protos.json')
165-
: nodejsProtoPath
166-
);
153+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
167154

168155
// This API contains "path templates"; forward-slash-separated
169156
// identifiers to uniquely identify resources within the API.

0 commit comments

Comments
 (0)