Skip to content

Commit

Permalink
fix: the return types for IAM service methods should be arrays, to ma…
Browse files Browse the repository at this point in the history
…tch ReturnTuple (googleapis#1001)

* fix: the return types for IAM service methods should be arrays, to match ReturnTuple

* fix: update PR to current types

* fix: also fix explicit typings for IAM

* build: work around circular dependency with kms (second PR to follow)

* docs: broken tsdoc
  • Loading branch information
feywind authored and leahecole committed Aug 21, 2023
1 parent 6eb75db commit e79cb28
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/iamService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class IamClient {
getIamPolicy(
request: protos.google.iam.v1.GetIamPolicyRequest,
options?: gax.CallOptions
): Promise<protos.google.iam.v1.Policy>;
): Promise<[protos.google.iam.v1.Policy]>;
getIamPolicy(
request: protos.google.iam.v1.GetIamPolicyRequest,
options: gax.CallOptions,
Expand Down Expand Up @@ -235,7 +235,7 @@ export class IamClient {
protos.google.iam.v1.GetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.Policy> {
): Promise<[protos.google.iam.v1.Policy]> {
let options: gax.CallOptions;
if (optionsOrCallback instanceof Function && callback === undefined) {
callback = optionsOrCallback as unknown as Callback<
Expand All @@ -262,7 +262,7 @@ export class IamClient {
setIamPolicy(
request: protos.google.iam.v1.SetIamPolicyRequest,
options?: gax.CallOptions
): Promise<protos.google.iam.v1.Policy>;
): Promise<[protos.google.iam.v1.Policy]>;
setIamPolicy(
request: protos.google.iam.v1.SetIamPolicyRequest,
options: gax.CallOptions,
Expand Down Expand Up @@ -294,7 +294,7 @@ export class IamClient {
protos.google.iam.v1.SetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.Policy> {
): Promise<[protos.google.iam.v1.Policy]> {
let options: gax.CallOptions;
if (optionsOrCallback instanceof Function && callback === undefined) {
callback = optionsOrCallback as unknown as Callback<
Expand All @@ -320,7 +320,7 @@ export class IamClient {
testIamPermissions(
request: protos.google.iam.v1.TestIamPermissionsRequest,
options?: gax.CallOptions
): Promise<protos.google.iam.v1.TestIamPermissionsResponse>;
): Promise<[protos.google.iam.v1.TestIamPermissionsResponse]>;
testIamPermissions(
request: protos.google.iam.v1.TestIamPermissionsRequest,
callback: Callback<
Expand Down Expand Up @@ -352,7 +352,7 @@ export class IamClient {
protos.google.iam.v1.TestIamPermissionsRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.TestIamPermissionsResponse> {
): Promise<[protos.google.iam.v1.TestIamPermissionsResponse]> {
let options: gax.CallOptions;
if (optionsOrCallback instanceof Function && callback === undefined) {
callback = optionsOrCallback as unknown as Callback<
Expand Down Expand Up @@ -408,7 +408,7 @@ export interface IamClient {
protos.google.iam.v1.GetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.Policy>;
): Promise<[protos.google.iam.v1.Policy]>;
setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest): void;
setIamPolicy(
request: protos.google.iam.v1.SetIamPolicyRequest,
Expand All @@ -424,7 +424,7 @@ export interface IamClient {
protos.google.iam.v1.SetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.Policy>;
): Promise<[protos.google.iam.v1.Policy]>;
testIamPermissions(
request: protos.google.iam.v1.TestIamPermissionsRequest
): void;
Expand All @@ -442,5 +442,5 @@ export interface IamClient {
protos.google.iam.v1.TestIamPermissionsRequest | null | undefined,
{} | null | undefined
>
): Promise<protos.google.iam.v1.TestIamPermissionsResponse>;
): Promise<[protos.google.iam.v1.TestIamPermissionsResponse]>;
}
8 changes: 8 additions & 0 deletions src/protosList.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[
"google/api/annotations.proto",
"google/api/apikeys/v2/apikeys.proto",
"google/api/apikeys/v2/resources.proto",
"google/api/auth.proto",
"google/api/backend.proto",
"google/api/billing.proto",
Expand Down Expand Up @@ -45,6 +47,7 @@
"google/api/servicecontrol/v1/operation.proto",
"google/api/servicecontrol/v1/quota_controller.proto",
"google/api/servicecontrol/v1/service_controller.proto",
"google/api/servicecontrol/v2/service_controller.proto",
"google/api/servicemanagement/v1/resources.proto",
"google/api/servicemanagement/v1/servicemanager.proto",
"google/api/serviceusage/v1/resources.proto",
Expand Down Expand Up @@ -77,11 +80,14 @@
"google/monitoring/v3/query_service.proto",
"google/monitoring/v3/service.proto",
"google/monitoring/v3/service_service.proto",
"google/monitoring/v3/snooze.proto",
"google/monitoring/v3/snooze_service.proto",
"google/monitoring/v3/span_context.proto",
"google/monitoring/v3/uptime.proto",
"google/monitoring/v3/uptime_service.proto",
"google/protobuf/any.proto",
"google/protobuf/api.proto",
"google/protobuf/bridge/message_set.proto",
"google/protobuf/compiler/plugin.proto",
"google/protobuf/compiler/ruby/ruby_generated_code.proto",
"google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto",
Expand All @@ -102,7 +108,9 @@
"google/protobuf/wrappers.proto",
"google/rpc/code.proto",
"google/rpc/context/attribute_context.proto",
"google/rpc/context/audit_context.proto",
"google/rpc/error_details.proto",
"google/rpc/http.proto",
"google/rpc/status.proto",
"google/type/calendar_period.proto",
"google/type/color.proto",
Expand Down
6 changes: 3 additions & 3 deletions test/showcase-echo-client/src/v1beta1/echo_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ export class EchoClient {
IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<IamProtos.google.iam.v1.Policy> {
): Promise<[IamProtos.google.iam.v1.Policy]> {
return this.iamClient.getIamPolicy(request, options, callback);
}

Expand Down Expand Up @@ -1355,7 +1355,7 @@ export class EchoClient {
IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined,
{} | null | undefined
>
): Promise<IamProtos.google.iam.v1.Policy> {
): Promise<[IamProtos.google.iam.v1.Policy]> {
return this.iamClient.setIamPolicy(request, options, callback);
}

Expand Down Expand Up @@ -1403,7 +1403,7 @@ export class EchoClient {
IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined,
{} | null | undefined
>
): Promise<IamProtos.google.iam.v1.TestIamPermissionsResponse> {
): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> {
return this.iamClient.testIamPermissions(request, options, callback);
}

Expand Down
5 changes: 3 additions & 2 deletions test/system-test/test.clientlibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ describe('Run system tests for some libraries', () => {

// KMS api has IAM service injected from gax. All its IAM related test are in samples-test.
// KMS is in the google-cloud-node monorepo
describe('kms', () => {
// Temporarily skipped to avoid circular dependency issue.
/*describe('kms', () => {
before(async () => {
await preparePackage('kms', true);
});
Expand All @@ -234,5 +235,5 @@ describe('Run system tests for some libraries', () => {
throw new Error('Test failed');
}
});
});
});*/
});

0 comments on commit e79cb28

Please sign in to comment.