Skip to content

Commit

Permalink
feat(kms): enable generation of Locations mixin (#578)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 481650929

Source-Link: https://togithub.com/googleapis/googleapis/commit/62e82e76c6ab8405731c1dfc9edb604745beedfb

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/d6de38b5d51dafb942ccd1268d6d04eb6ff116af
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDZkZTM4YjVkNTFkYWZiOTQyY2NkMTI2OGQ2ZDA0ZWI2ZmYxMTZhZiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 10, 2022
1 parent 050c1da commit d76fc1e
Show file tree
Hide file tree
Showing 4 changed files with 581 additions and 2 deletions.
89 changes: 89 additions & 0 deletions packages/google-cloud-kms/src/v1/ekm_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import type {
GaxCall,
IamClient,
IamProtos,
LocationsClient,
LocationProtos,
} from 'google-gax';
import {Transform} from 'stream';
import * as protos from '../../protos/protos';
Expand Down Expand Up @@ -66,6 +68,7 @@ export class EkmServiceClient {
warn: (code: string, message: string, warnType?: string) => void;
innerApiCalls: {[name: string]: Function};
iamClient: IamClient;
locationsClient: LocationsClient;
pathTemplates: {[name: string]: gax.PathTemplate};
ekmServiceStub?: Promise<{[name: string]: Function}>;

Expand Down Expand Up @@ -161,6 +164,11 @@ export class EkmServiceClient {
}
this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts);

this.locationsClient = new this._gaxModule.LocationsClient(
this._gaxGrpc,
opts
);

// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
Expand Down Expand Up @@ -1007,6 +1015,86 @@ export class EkmServiceClient {
return this.iamClient.testIamPermissions(request, options, callback);
}

/**
* Gets information about a location.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Resource name for the location.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Location]{@link google.cloud.location.Location}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example
* ```
* const [response] = await client.getLocation(request);
* ```
*/
getLocation(
request: LocationProtos.google.cloud.location.IGetLocationRequest,
options?:
| gax.CallOptions
| Callback<
LocationProtos.google.cloud.location.ILocation,
| LocationProtos.google.cloud.location.IGetLocationRequest
| null
| undefined,
{} | null | undefined
>,
callback?: Callback<
LocationProtos.google.cloud.location.ILocation,
| LocationProtos.google.cloud.location.IGetLocationRequest
| null
| undefined,
{} | null | undefined
>
): Promise<LocationProtos.google.cloud.location.ILocation> {
return this.locationsClient.getLocation(request, options, callback);
}

/**
* Lists information about the supported locations for this service. Returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* The resource that owns the locations collection, if applicable.
* @param {string} request.filter
* The standard list filter.
* @param {number} request.pageSize
* The standard list page size.
* @param {string} request.pageToken
* The standard list page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* ```
* const iterable = client.listLocationsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* ```
*/
listLocationsAsync(
request: LocationProtos.google.cloud.location.IListLocationsRequest,
options?: CallOptions
): AsyncIterable<LocationProtos.google.cloud.location.ILocation> {
return this.locationsClient.listLocationsAsync(request, options);
}

// --------------------
// -- Path templates --
// --------------------
Expand Down Expand Up @@ -1479,6 +1567,7 @@ export class EkmServiceClient {
this._terminated = true;
stub.close();
this.iamClient.close();
this.locationsClient.close();
});
}
return Promise.resolve();
Expand Down
89 changes: 89 additions & 0 deletions packages/google-cloud-kms/src/v1/key_management_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import type {
GaxCall,
IamClient,
IamProtos,
LocationsClient,
LocationProtos,
} from 'google-gax';
import {Transform} from 'stream';
import * as protos from '../../protos/protos';
Expand Down Expand Up @@ -73,6 +75,7 @@ export class KeyManagementServiceClient {
warn: (code: string, message: string, warnType?: string) => void;
innerApiCalls: {[name: string]: Function};
iamClient: IamClient;
locationsClient: LocationsClient;
pathTemplates: {[name: string]: gax.PathTemplate};
keyManagementServiceStub?: Promise<{[name: string]: Function}>;

Expand Down Expand Up @@ -168,6 +171,11 @@ export class KeyManagementServiceClient {
}
this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts);

this.locationsClient = new this._gaxModule.LocationsClient(
this._gaxGrpc,
opts
);

// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
Expand Down Expand Up @@ -3898,6 +3906,86 @@ export class KeyManagementServiceClient {
return this.iamClient.testIamPermissions(request, options, callback);
}

/**
* Gets information about a location.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Resource name for the location.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Location]{@link google.cloud.location.Location}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example
* ```
* const [response] = await client.getLocation(request);
* ```
*/
getLocation(
request: LocationProtos.google.cloud.location.IGetLocationRequest,
options?:
| gax.CallOptions
| Callback<
LocationProtos.google.cloud.location.ILocation,
| LocationProtos.google.cloud.location.IGetLocationRequest
| null
| undefined,
{} | null | undefined
>,
callback?: Callback<
LocationProtos.google.cloud.location.ILocation,
| LocationProtos.google.cloud.location.IGetLocationRequest
| null
| undefined,
{} | null | undefined
>
): Promise<LocationProtos.google.cloud.location.ILocation> {
return this.locationsClient.getLocation(request, options, callback);
}

/**
* Lists information about the supported locations for this service. Returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* The resource that owns the locations collection, if applicable.
* @param {string} request.filter
* The standard list filter.
* @param {number} request.pageSize
* The standard list page size.
* @param {string} request.pageToken
* The standard list page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* ```
* const iterable = client.listLocationsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* ```
*/
listLocationsAsync(
request: LocationProtos.google.cloud.location.IListLocationsRequest,
options?: CallOptions
): AsyncIterable<LocationProtos.google.cloud.location.ILocation> {
return this.locationsClient.listLocationsAsync(request, options);
}

// --------------------
// -- Path templates --
// --------------------
Expand Down Expand Up @@ -4370,6 +4458,7 @@ export class KeyManagementServiceClient {
this._terminated = true;
stub.close();
this.iamClient.close();
this.locationsClient.close();
});
}
return Promise.resolve();
Expand Down
Loading

0 comments on commit d76fc1e

Please sign in to comment.