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

Commit

Permalink
feat: make operationsClient and service stub public
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and alexander-fenster committed Dec 11, 2019
1 parent ddb4cca commit 2fa96df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions src/v1/cloud_build_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ const version = require('../../../package.json').version;
*/
export class CloudBuildClient {
private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}};
private _cloudBuildStub: Promise<{[name: string]: Function}>;
private _innerApiCalls: {[name: string]: Function};
private _terminated = false;
auth: gax.GoogleAuth;
operationsClient: gax.OperationsClient;
cloudBuildStub: Promise<{[name: string]: Function}>;

/**
* Construct an instance of CloudBuildClient.
Expand Down Expand Up @@ -168,7 +169,7 @@ export class CloudBuildClient {
? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json'))
: gaxModule.protobuf.loadSync(nodejsProtoPath);

const operationsClient = gaxModule
this.operationsClient = gaxModule
.lro({
auth: this.auth,
grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined,
Expand All @@ -195,17 +196,17 @@ export class CloudBuildClient {

this._descriptors.longrunning = {
createBuild: new gaxModule.LongrunningDescriptor(
operationsClient,
this.operationsClient,
createBuildResponse.decode.bind(createBuildResponse),
createBuildMetadata.decode.bind(createBuildMetadata)
),
retryBuild: new gaxModule.LongrunningDescriptor(
operationsClient,
this.operationsClient,
retryBuildResponse.decode.bind(retryBuildResponse),
retryBuildMetadata.decode.bind(retryBuildMetadata)
),
runBuildTrigger: new gaxModule.LongrunningDescriptor(
operationsClient,
this.operationsClient,
runBuildTriggerResponse.decode.bind(runBuildTriggerResponse),
runBuildTriggerMetadata.decode.bind(runBuildTriggerMetadata)
),
Expand All @@ -226,7 +227,7 @@ export class CloudBuildClient {

// Put together the "service stub" for
// google.devtools.cloudbuild.v1.CloudBuild.
this._cloudBuildStub = gaxGrpc.createStub(
this.cloudBuildStub = gaxGrpc.createStub(
opts.fallback
? (protos as protobuf.Root).lookupService(
'google.devtools.cloudbuild.v1.CloudBuild'
Expand Down Expand Up @@ -258,7 +259,7 @@ export class CloudBuildClient {
];

for (const methodName of cloudBuildStubMethods) {
const innerCallPromise = this._cloudBuildStub.then(
const innerCallPromise = this.cloudBuildStub.then(
stub => (...args: Array<{}>) => {
return stub[methodName].apply(stub, args);
},
Expand Down Expand Up @@ -1688,7 +1689,7 @@ export class CloudBuildClient {
*/
close(): Promise<void> {
if (!this._terminated) {
return this._cloudBuildStub.then(stub => {
return this.cloudBuildStub.then(stub => {
this._terminated = true;
stub.close();
});
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"updateTime": "2019-12-10T12:12:01.622533Z",
"updateTime": "2019-12-11T12:12:24.059572Z",
"sources": [
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "6cc9499e225a4f6a5e34fe07e390f67055d7991c",
"internalRef": "284643689"
"sha": "e47fdd266542386e5e7346697f90476e96dc7ee8",
"internalRef": "284822593"
}
},
{
Expand Down

0 comments on commit 2fa96df

Please sign in to comment.