Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit 60b8213

Browse files
yoshi-automationalexander-fenster
authored andcommitted
fix: make operationsClient and service stub public
1 parent 362c159 commit 60b8213

4 files changed

Lines changed: 47 additions & 61 deletions

File tree

protos/google/cloud/common_resources.proto

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,31 @@ package google.cloud;
2222
import "google/api/resource.proto";
2323

2424

25-
message Project {
26-
option (google.api.resource) = {
27-
type: "cloudresourcemanager.googleapis.com/Project"
28-
pattern: "projects/{project}"
29-
};
25+
option (google.api.resource_definition) = {
26+
type: "cloudresourcemanager.googleapis.com/Project"
27+
pattern: "projects/{project}"
28+
};
3029

31-
string name = 1;
32-
}
3330

34-
message Organization {
35-
option (google.api.resource) = {
36-
type: "cloudresourcemanager.googleapis.com/Organization"
37-
pattern: "organizations/{organization}"
38-
};
31+
option (google.api.resource_definition) = {
32+
type: "cloudresourcemanager.googleapis.com/Organization"
33+
pattern: "organizations/{organization}"
34+
};
3935

40-
string name = 1;
41-
}
4236

43-
message Folder {
44-
option (google.api.resource) = {
45-
type: "cloudresourcemanager.googleapis.com/Folder"
46-
pattern: "folders/{folder}"
47-
};
37+
option (google.api.resource_definition) = {
38+
type: "cloudresourcemanager.googleapis.com/Folder"
39+
pattern: "folders/{folder}"
40+
};
4841

49-
string name = 1;
50-
}
5142

52-
message BillingAccount {
53-
option (google.api.resource) = {
54-
type: "cloudbilling.googleapis.com/BillingAccount"
55-
pattern: "billingAccounts/{billing_account}"
56-
};
43+
option (google.api.resource_definition) = {
44+
type: "cloudbilling.googleapis.com/BillingAccount"
45+
pattern: "billingAccounts/{billing_account}"
46+
};
5747

58-
string name = 1;
59-
}
48+
option (google.api.resource_definition) = {
49+
type: "locations.googleapis.com/Location"
50+
pattern: "projects/{project}/locations/{location}"
51+
};
6052

61-
message Location {
62-
option (google.api.resource) = {
63-
type: "locations.googleapis.com/Location"
64-
pattern: "projects/{project}/locations/{location}"
65-
};
66-
67-
string name = 1;
68-
}

src/v1/cloud_redis_client.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ const version = require('../../../package.json').version;
5656
*/
5757
export class CloudRedisClient {
5858
private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}};
59-
private _cloudRedisStub: Promise<{[name: string]: Function}>;
6059
private _innerApiCalls: {[name: string]: Function};
6160
private _pathTemplates: {[name: string]: gax.PathTemplate};
6261
private _terminated = false;
6362
auth: gax.GoogleAuth;
63+
operationsClient: gax.OperationsClient;
64+
cloudRedisStub: Promise<{[name: string]: Function}>;
6465

6566
/**
6667
* Construct an instance of CloudRedisClient.
@@ -183,7 +184,7 @@ export class CloudRedisClient {
183184
? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json'))
184185
: gaxModule.protobuf.loadSync(nodejsProtoPath);
185186

186-
const operationsClient = gaxModule
187+
this.operationsClient = gaxModule
187188
.lro({
188189
auth: this.auth,
189190
grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined,
@@ -228,32 +229,32 @@ export class CloudRedisClient {
228229

229230
this._descriptors.longrunning = {
230231
createInstance: new gaxModule.LongrunningDescriptor(
231-
operationsClient,
232+
this.operationsClient,
232233
createInstanceResponse.decode.bind(createInstanceResponse),
233234
createInstanceMetadata.decode.bind(createInstanceMetadata)
234235
),
235236
updateInstance: new gaxModule.LongrunningDescriptor(
236-
operationsClient,
237+
this.operationsClient,
237238
updateInstanceResponse.decode.bind(updateInstanceResponse),
238239
updateInstanceMetadata.decode.bind(updateInstanceMetadata)
239240
),
240241
importInstance: new gaxModule.LongrunningDescriptor(
241-
operationsClient,
242+
this.operationsClient,
242243
importInstanceResponse.decode.bind(importInstanceResponse),
243244
importInstanceMetadata.decode.bind(importInstanceMetadata)
244245
),
245246
exportInstance: new gaxModule.LongrunningDescriptor(
246-
operationsClient,
247+
this.operationsClient,
247248
exportInstanceResponse.decode.bind(exportInstanceResponse),
248249
exportInstanceMetadata.decode.bind(exportInstanceMetadata)
249250
),
250251
failoverInstance: new gaxModule.LongrunningDescriptor(
251-
operationsClient,
252+
this.operationsClient,
252253
failoverInstanceResponse.decode.bind(failoverInstanceResponse),
253254
failoverInstanceMetadata.decode.bind(failoverInstanceMetadata)
254255
),
255256
deleteInstance: new gaxModule.LongrunningDescriptor(
256-
operationsClient,
257+
this.operationsClient,
257258
deleteInstanceResponse.decode.bind(deleteInstanceResponse),
258259
deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)
259260
),
@@ -274,7 +275,7 @@ export class CloudRedisClient {
274275

275276
// Put together the "service stub" for
276277
// google.cloud.redis.v1.CloudRedis.
277-
this._cloudRedisStub = gaxGrpc.createStub(
278+
this.cloudRedisStub = gaxGrpc.createStub(
278279
opts.fallback
279280
? (protos as protobuf.Root).lookupService(
280281
'google.cloud.redis.v1.CloudRedis'
@@ -298,7 +299,7 @@ export class CloudRedisClient {
298299
];
299300

300301
for (const methodName of cloudRedisStubMethods) {
301-
const innerCallPromise = this._cloudRedisStub.then(
302+
const innerCallPromise = this.cloudRedisStub.then(
302303
stub => (...args: Array<{}>) => {
303304
return stub[methodName].apply(stub, args);
304305
},
@@ -1280,7 +1281,7 @@ export class CloudRedisClient {
12801281
*/
12811282
close(): Promise<void> {
12821283
if (!this._terminated) {
1283-
return this._cloudRedisStub.then(stub => {
1284+
return this.cloudRedisStub.then(stub => {
12841285
this._terminated = true;
12851286
stub.close();
12861287
});

src/v1beta1/cloud_redis_client.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ const version = require('../../../package.json').version;
5656
*/
5757
export class CloudRedisClient {
5858
private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}};
59-
private _cloudRedisStub: Promise<{[name: string]: Function}>;
6059
private _innerApiCalls: {[name: string]: Function};
6160
private _pathTemplates: {[name: string]: gax.PathTemplate};
6261
private _terminated = false;
6362
auth: gax.GoogleAuth;
63+
operationsClient: gax.OperationsClient;
64+
cloudRedisStub: Promise<{[name: string]: Function}>;
6465

6566
/**
6667
* Construct an instance of CloudRedisClient.
@@ -183,7 +184,7 @@ export class CloudRedisClient {
183184
? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json'))
184185
: gaxModule.protobuf.loadSync(nodejsProtoPath);
185186

186-
const operationsClient = gaxModule
187+
this.operationsClient = gaxModule
187188
.lro({
188189
auth: this.auth,
189190
grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined,
@@ -228,32 +229,32 @@ export class CloudRedisClient {
228229

229230
this._descriptors.longrunning = {
230231
createInstance: new gaxModule.LongrunningDescriptor(
231-
operationsClient,
232+
this.operationsClient,
232233
createInstanceResponse.decode.bind(createInstanceResponse),
233234
createInstanceMetadata.decode.bind(createInstanceMetadata)
234235
),
235236
updateInstance: new gaxModule.LongrunningDescriptor(
236-
operationsClient,
237+
this.operationsClient,
237238
updateInstanceResponse.decode.bind(updateInstanceResponse),
238239
updateInstanceMetadata.decode.bind(updateInstanceMetadata)
239240
),
240241
importInstance: new gaxModule.LongrunningDescriptor(
241-
operationsClient,
242+
this.operationsClient,
242243
importInstanceResponse.decode.bind(importInstanceResponse),
243244
importInstanceMetadata.decode.bind(importInstanceMetadata)
244245
),
245246
exportInstance: new gaxModule.LongrunningDescriptor(
246-
operationsClient,
247+
this.operationsClient,
247248
exportInstanceResponse.decode.bind(exportInstanceResponse),
248249
exportInstanceMetadata.decode.bind(exportInstanceMetadata)
249250
),
250251
failoverInstance: new gaxModule.LongrunningDescriptor(
251-
operationsClient,
252+
this.operationsClient,
252253
failoverInstanceResponse.decode.bind(failoverInstanceResponse),
253254
failoverInstanceMetadata.decode.bind(failoverInstanceMetadata)
254255
),
255256
deleteInstance: new gaxModule.LongrunningDescriptor(
256-
operationsClient,
257+
this.operationsClient,
257258
deleteInstanceResponse.decode.bind(deleteInstanceResponse),
258259
deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)
259260
),
@@ -274,7 +275,7 @@ export class CloudRedisClient {
274275

275276
// Put together the "service stub" for
276277
// google.cloud.redis.v1beta1.CloudRedis.
277-
this._cloudRedisStub = gaxGrpc.createStub(
278+
this.cloudRedisStub = gaxGrpc.createStub(
278279
opts.fallback
279280
? (protos as protobuf.Root).lookupService(
280281
'google.cloud.redis.v1beta1.CloudRedis'
@@ -298,7 +299,7 @@ export class CloudRedisClient {
298299
];
299300

300301
for (const methodName of cloudRedisStubMethods) {
301-
const innerCallPromise = this._cloudRedisStub.then(
302+
const innerCallPromise = this.cloudRedisStub.then(
302303
stub => (...args: Array<{}>) => {
303304
return stub[methodName].apply(stub, args);
304305
},
@@ -1281,7 +1282,7 @@ export class CloudRedisClient {
12811282
*/
12821283
close(): Promise<void> {
12831284
if (!this._terminated) {
1284-
return this._cloudRedisStub.then(stub => {
1285+
return this.cloudRedisStub.then(stub => {
12851286
this._terminated = true;
12861287
stub.close();
12871288
});

synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"updateTime": "2019-11-22T19:35:19.156645Z",
2+
"updateTime": "2019-12-11T12:22:09.668236Z",
33
"sources": [
44
{
55
"git": {
66
"name": "googleapis",
77
"remote": "https://github.com/googleapis/googleapis.git",
8-
"sha": "3ba7ddc4b2acf532bdfb0004ca26311053c11c30",
9-
"internalRef": "281852671"
8+
"sha": "e47fdd266542386e5e7346697f90476e96dc7ee8",
9+
"internalRef": "284822593"
1010
}
1111
},
1212
{

0 commit comments

Comments
 (0)