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

Commit

Permalink
feat: AuditConfig for IAM v1 (#20)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 439356405

Source-Link: googleapis/googleapis@afa2ba1

Source-Link: googleapis/googleapis-gen@3e40c17
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2U0MGMxN2UxNTEwYzk1ZmFiNThmYzIxNDNjY2I2MWNjZWNhNTk4OSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Apr 22, 2022
1 parent 6a546e8 commit 68b9b07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
* SetIamPolicyRequest.newBuilder()
* .setResource(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Policy response = servicesClient.setIamPolicy(request);
* }
Expand All @@ -855,6 +856,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
* SetIamPolicyRequest.newBuilder()
* .setResource(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture<Policy> future = servicesClient.setIamPolicyCallable().futureCall(request);
* // Do something.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.api.gax.rpc.StatusCode;
import com.google.common.collect.Lists;
import com.google.iam.v1.AuditConfig;
import com.google.iam.v1.Binding;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.GetPolicyOptions;
Expand Down Expand Up @@ -713,6 +714,7 @@ public void getIamPolicyTest() throws Exception {
Policy.newBuilder()
.setVersion(351608024)
.addAllBindings(new ArrayList<Binding>())
.addAllAuditConfigs(new ArrayList<AuditConfig>())
.setEtag(ByteString.EMPTY)
.build();
mockServices.addResponse(expectedResponse);
Expand Down Expand Up @@ -762,6 +764,7 @@ public void setIamPolicyTest() throws Exception {
Policy.newBuilder()
.setVersion(351608024)
.addAllBindings(new ArrayList<Binding>())
.addAllAuditConfigs(new ArrayList<AuditConfig>())
.setEtag(ByteString.EMPTY)
.build();
mockServices.addResponse(expectedResponse);
Expand All @@ -770,6 +773,7 @@ public void setIamPolicyTest() throws Exception {
SetIamPolicyRequest.newBuilder()
.setResource(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();

Policy actualResponse = client.setIamPolicy(request);
Expand All @@ -781,6 +785,7 @@ public void setIamPolicyTest() throws Exception {

Assert.assertEquals(request.getResource(), actualRequest.getResource());
Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy());
Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -797,6 +802,7 @@ public void setIamPolicyExceptionTest() throws Exception {
SetIamPolicyRequest.newBuilder()
.setResource(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
client.setIamPolicy(request);
Assert.fail("No exception raised");
Expand Down

0 comments on commit 68b9b07

Please sign in to comment.