Skip to content

Commit

Permalink
fix: Use bindings for resolving multi pattern resources (#1818)
Browse files Browse the repository at this point in the history
* fix: Use bindings for resolving multi pattern resources

* chore: Fix lint issues

* chore: Add unit tests for the behavior

* chore: Add comments for the tests

* chore: Remove unused comment

* feat: support GDC-H Credentials  (#1642)

* chore: initial additions to handle GDC-H API audience

* chore: add unit tests for GDC-H

* chore: cleanup of logic

* chore: decompose tests into separate methods

* chore: fix clirr diff check

* chore: fmt:format

* chore: add support in `ClientSettings`

* chore: add showcase IT for GDCH credentials

* chore: comments

* chore: improve tests

* chore: add partial IT for testing context credential

* chore: recreate GdchCredentials with audience using convenience method

* chore: more readable api audience logic

* chore: no wildcard imports

* chore: javadoc for public methods

* chore: gdch test to use default null initialization

* chore: tear down for gdch IT

* chore: `assertThrows` for gdch ITs

* chore: mvn fmt:format

* test: remove context test

* docs: explain that audience will be overriden if set through client/stub settings

* test: test audience setting should modify initial credentials

* chore: clirr check

* chore: ignore gdch changes

* chore: format

* chore: default to endpoint if audience not provided

* test: refresh gdch creds to confirm audience works

* chore: fmt

* chore: fmt

* chore: better test names in ClientContextTest

* chore: better test names for showcase tests

* chore: simplify refresh verification logic

* chore: include outcome in gdch it test names

* chore: expand comments in GDCH ITs

* test: intercept mock transport to verify audience

* chore: fmt

* chore: move auth test-jar to shared dependencies

* chore: cleanup

* chore: use inferred version for auth library

* deps: update google-auth-java-library to 1.19.0

* choreL fmt ITGdch.java

* chore: import auth test-jar using common version variable

* chore: remove auth test-jar import from first-party-dependencies

* chore: add license headers to new files

* chore: revert google-auth-version to be obtained from main branch

* chore: correct showcase parent pom indentation

* chore: remove resource declaration for native test build

* fix: [gapic-generator-java] handle response and metadata type ambiguity in LRO parsing (#1726)

* chore: Bump grpc-java version to 1.55.3 (#1829)

* chore: Bump gapic-showcase version to 0.28.2 (#1830)

* build(deps): Bump guava version to 32.1.1-jre (#1832)

* chore: Bump guava version to 32.1.1-jre

* chore: Add guava to gradle template

* chore: Add j2obc-annotations to shared-dependencies (#1834)

* ci: fix showcase-clirr check on release PRs (#1835)

Install sdk-platform-java before performing final clirr check, so version changes are available in the local repository

* chore(main): release 2.23.0 (#1806)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore(main): release 2.23.1-SNAPSHOT (#1836)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore: Implement gRPC and HttpJson showcase tests for IAM (#1789)

* chore: Add framework for iam showcase tests

* chore: Generate clients with IAM stubs

* chore: Add IAM showcase tests

* chore: Add samples

* chore: Exclude httpjson tests

* chore: Use @before to create the resource

* chore: Use constant for policy

* chore: Log resource name

* chore: Test use setPolicyRequest's resourceName

* chore: run mvn clean before showcase tests

* chore: Attempt again with cache deleted

* chore: Add logging for test

* chore: Sleep for 1s

* chore: Use resource from setPolicyRequest

* chore: Ignore failing HttpJson test for now

* chore: Un-ignore test

* chore: Fix lint issues

* chore: Test with rooms/ prefix

* chore: Use Identity client for Users

* chore: Create user resource to assign policy to

* chore: Use user's name as resource id

* chore: Change resource name before each test

* chore: Add iam-grpc in pom

* chore: Resolve sonar issues

* chore: Add comment for testIamPolicy

* chore: Address PR comments

* ci: showcase native check (#1833)

* ci: showcase native check

* fix: add explicit java version

* fix: adjust syntax

* fix: add resource-config entry for ITGdch

* fix: copy file to temp folder so it can be accessed by path

* chore: formatting

* fix: prevent shutdown warnings with client.awaitTermination

* ci: fix build file location for downstream test

* chore: use static imports for Truth assertions

* chore: Resolve merge conflicts

* chore: Use bindings for any matching resource patterns

* chore: Fix lint issues

* chore: Remove unused code

* chore: Fix lint issues

* chore: Add test for resourceName matching bindings

* chore: Fix lint issues

---------

Co-authored-by: Diego Alonso Marquez Palacios <diegomarquezp@google.com>
Co-authored-by: Emily Wang <emmwang@google.com>
Co-authored-by: Burke Davison <40617934+burkedavison@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Jul 17, 2023
1 parent 194097a commit 1352fab
Show file tree
Hide file tree
Showing 57 changed files with 318 additions and 456 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,25 @@ public static Expr createMethodArgValue(
}

if (methodArg.type().equals(methodArg.field().type())) {
return createValue(methodArg.field(), false, resourceNames, messageTypes, valuePatterns);
return createValue(
methodArg.field(), false, resourceNames, messageTypes, valuePatterns, bindings);
}

return createValue(Field.builder().setName(methodArg.name()).setType(methodArg.type()).build());
}

public static Expr createValue(Field field) {
return createValue(
field, false, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
field, false, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), null);
}

public static Expr createValue(
Field field,
boolean useExplicitInitTypeInGenerics,
Map<String, ResourceName> resourceNames,
Map<String, Message> messageTypes,
Map<String, String> valuePatterns) {
Map<String, String> valuePatterns,
HttpBindings bindings) {
if (field.isRepeated()) {
ConcreteReference.Builder refBuilder =
ConcreteReference.builder().setClazz(field.isMap() ? HashMap.class : ArrayList.class);
Expand Down Expand Up @@ -161,7 +163,7 @@ public static Expr createValue(
Message nestedMessage = messageTypes.get(field.type().reference().fullName());
if (nestedMessage != null) {
return createSimpleMessageBuilderValue(
nestedMessage, resourceNames, messageTypes, nestedValuePatterns, null);
nestedMessage, resourceNames, messageTypes, nestedValuePatterns, bindings);
}
}

Expand Down Expand Up @@ -274,7 +276,7 @@ static Expr createResourceHelperValue(
if (!resname.isOnlyWildcard()
&& (bindings == null || resname.getMatchingPattern(bindings) != null)) {
return createResourceHelperValue(
resname, false, unexaminedResnames, fieldOrMessageName, null);
resname, false, unexaminedResnames, fieldOrMessageName, bindings);
}
}

Expand Down Expand Up @@ -420,7 +422,8 @@ public static Expr createSimpleMessageBuilderValue(
}

if (defaultExpr == null) {
defaultExpr = createValue(field, true, resourceNames, messageTypes, valuePatterns);
defaultExpr =
createValue(field, true, resourceNames, messageTypes, valuePatterns, bindings);
}
}
builderExpr =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import com.google.api.generator.gapic.model.ResourceName;
import com.google.api.generator.gapic.protoparser.Parser;
import com.google.api.generator.test.utils.LineFormatter;
import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;
import com.google.protobuf.Descriptors.FileDescriptor;
import com.google.protobuf.StructProto;
import com.google.showcase.v1beta1.EchoOuterClass;
import com.google.showcase.v1beta1.MessagingOuterClass;
import com.google.testgapic.v1beta1.LockerProto;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -174,7 +176,7 @@ public void defaultValue_resourceNameWithOnePattern() {
}

@Test
public void defaultValue_resourceNameWithMultiplePatterns() {
public void defaultValue_resourceNameWithMultiplePatterns_noBindings() {
FileDescriptor lockerServiceFileDescriptor = LockerProto.getDescriptor();
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(lockerServiceFileDescriptor);
Expand All @@ -188,10 +190,45 @@ public void defaultValue_resourceNameWithMultiplePatterns() {
"ignored",
null);
expr.accept(writerVisitor);
/*
There are two patterns:
- pattern: "projects/{project}/folders/{folder}"
- pattern: "folders/{folder}"
It matches the first one given no bindings
*/
assertEquals(
"FolderName.ofProjectFolderName(\"[PROJECT]\", \"[FOLDER]\")", writerVisitor.write());
}

@Test
public void defaultValue_resourceNameWithMultiplePatterns_matchesBindings() {
FileDescriptor lockerServiceFileDescriptor = LockerProto.getDescriptor();
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(lockerServiceFileDescriptor);
ResourceName resourceName =
typeStringsToResourceNames.get("cloudresourcemanager.googleapis.com/Folder");
Expr expr =
DefaultValueComposer.createResourceHelperValue(
resourceName,
false,
typeStringsToResourceNames.values().stream().collect(Collectors.toList()),
"folder",
HttpBindings.builder()
.setHttpVerb(HttpVerb.POST)
.setPattern("/v1/{name=folders/*}")
.setAdditionalPatterns(ImmutableList.of())
.setIsAsteriskBody(true)
.build());
expr.accept(writerVisitor);
/*
There are two patterns:
- pattern: "projects/{project}/folders/{folder}"
- pattern: "folders/{folder}"
It attempts to match the correct HttpBinding
*/
assertEquals("FolderName.ofFolderName(\"[FOLDER]\")", writerVisitor.write());
}

@Test
public void defaultValue_resourceNameWithWildcardPattern() {
FileDescriptor lockerServiceFileDescriptor = LockerProto.getDescriptor();
Expand Down Expand Up @@ -374,6 +411,131 @@ public void defaultValue_resourceNameWithOnlyWildcards_allowAnonResourceNameClas
assertEquals(expected, writerVisitor.write());
}

@Test
public void createSimpleMessageBuilderValue_resourceNameMultiplePatterns_matchesHttpBinding() {
FileDescriptor messagingFileDescriptor = MessagingOuterClass.getDescriptor();
Map<String, Message> messageTypes = Parser.parseMessages(messagingFileDescriptor);
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(messagingFileDescriptor);
/*
Blurb Resource contains four patterns (in order of):
- pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}"
- pattern: "users/{user}/profile/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}"
*/
Message message = messageTypes.get("com.google.showcase.v1beta1.Blurb");

HttpBindings bindings =
HttpBindings.builder()
.setHttpVerb(HttpVerb.PATCH)
.setPattern("/v1beta1/{blurb.name=rooms/*/blurbs/*}")
.setAdditionalPatterns(
Collections.singletonList("/v1beta1/{blurb.name=users/*/profile/blurbs/*}"))
.setIsAsteriskBody(false)
.build();

Expr expr =
DefaultValueComposer.createSimpleMessageBuilderValue(
message, typeStringsToResourceNames, messageTypes, bindings);
expr.accept(writerVisitor);
// Matches with the default pattern in the HttpBindings and uses the variables in the pattern
assertEquals(
"Blurb.newBuilder().setName(BlurbName.ofRoomBlurbName(\"[ROOM]\", \"[BLURB]\").toString()).build()",
writerVisitor.write());
}

@Test
public void
createSimpleMessageBuilderValue_resourceNameMultiplePatterns_matchesAdditionalHttpBinding() {
FileDescriptor messagingFileDescriptor = MessagingOuterClass.getDescriptor();
Map<String, Message> messageTypes = Parser.parseMessages(messagingFileDescriptor);
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(messagingFileDescriptor);
/*
Blurb Resource contains four patterns (in order of):
- pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}"
- pattern: "users/{user}/profile/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}"
*/
Message message = messageTypes.get("com.google.showcase.v1beta1.Blurb");

HttpBindings bindings =
HttpBindings.builder()
.setHttpVerb(HttpVerb.PATCH)
.setPattern("/v1beta1/{blurb.name=invalid/pattern/*}")
.setAdditionalPatterns(
Collections.singletonList("/v1beta1/{blurb.name=users/*/profile/blurbs/*}"))
.setIsAsteriskBody(false)
.build();

Expr expr =
DefaultValueComposer.createSimpleMessageBuilderValue(
message, typeStringsToResourceNames, messageTypes, bindings);
expr.accept(writerVisitor);
// Because the default pattern does not match, it will attempt to match with patterns in the
// additional bindings and use variables for any pattern that matches
assertEquals(
"Blurb.newBuilder().setName(BlurbName.ofUserBlurbName(\"[USER]\", \"[BLURB]\").toString()).build()",
writerVisitor.write());
}

@Test
public void
createSimpleMessageBuilderValue_resourceNameMultiplePatterns_doesNotMatchHttpBinding() {
FileDescriptor messagingFileDescriptor = MessagingOuterClass.getDescriptor();
Map<String, Message> messageTypes = Parser.parseMessages(messagingFileDescriptor);
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(messagingFileDescriptor);
/*
Blurb Resource contains four patterns (in order of):
- pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}"
- pattern: "users/{user}/profile/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/{blurb}"
- pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}"
*/
Message message = messageTypes.get("com.google.showcase.v1beta1.Blurb");

HttpBindings bindings =
HttpBindings.builder()
.setHttpVerb(HttpVerb.PATCH)
.setPattern("/v1beta1/{blurb.name=invalid/pattern/*}")
.setAdditionalPatterns(
Collections.singletonList("/v1beta1/{blurb.name=nothing/matches/*}"))
.setIsAsteriskBody(false)
.build();

Expr expr =
DefaultValueComposer.createSimpleMessageBuilderValue(
message, typeStringsToResourceNames, messageTypes, bindings);
expr.accept(writerVisitor);
// If no pattern matches (default and additional bindings), it will simply pick the first
// resource pattern in the resource definition.
assertEquals(
"Blurb.newBuilder().setName(BlurbName.ofUserLegacyUserBlurbName(\"[USER]\", \"[LEGACY_USER]\", \"[BLURB]\").toString()).build()",
writerVisitor.write());
}

@Test
public void defaultValue_resourceNameMultiplePatterns_noHttpBinding() {
FileDescriptor messagingFileDescriptor = MessagingOuterClass.getDescriptor();
Map<String, Message> messageTypes = Parser.parseMessages(messagingFileDescriptor);
Map<String, ResourceName> typeStringsToResourceNames =
Parser.parseResourceNames(messagingFileDescriptor);
Message message = messageTypes.get("com.google.showcase.v1beta1.Blurb");

Expr expr =
DefaultValueComposer.createSimpleMessageBuilderValue(
message, typeStringsToResourceNames, messageTypes, null);
expr.accept(writerVisitor);
// If no pattern matches (default and additional bindings), it will simply pick the first
// resource pattern in the resource definition.
assertEquals(
"Blurb.newBuilder().setName(BlurbName.ofUserLegacyUserBlurbName(\"[USER]\", \"[LEGACY_USER]\", \"[BLURB]\").toString()).build()",
writerVisitor.write());
}

@Test
public void createSimpleMessage_basicPrimitivesOnly() {
FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncGetIamPolicy() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = complianceClient.getIamPolicyCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncGetIamPolicy() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = complianceClient.getIamPolicy(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncSetIamPolicy() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncSetIamPolicy() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncTestIamPermissions() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncTestIamPermissions() throws Exception {
try (ComplianceClient complianceClient = ComplianceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = complianceClient.testIamPermissions(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncGetIamPolicy() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = echoClient.getIamPolicyCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncGetIamPolicy() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = echoClient.getIamPolicy(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncSetIamPolicy() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncSetIamPolicy() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncTestIamPermissions() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static void syncTestIamPermissions() throws Exception {
try (EchoClient echoClient = EchoClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = echoClient.testIamPermissions(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public static void asyncGetIamPolicy() throws Exception {
try (IdentityClient identityClient = IdentityClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]")
.toString())
.setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = identityClient.getIamPolicyCallable().futureCall(request);
Expand Down
Loading

0 comments on commit 1352fab

Please sign in to comment.