Skip to content

Commit

Permalink
feat: add reCAPTCHA Enterprise account defender API methods
Browse files Browse the repository at this point in the history
This cl adds the following API methods to support the Preview release of reCAPTCHA Enterprise account defender: ListRelatedAccountGroups, ListRelatedAccountGroupMemberships, and SearchRelatedAccountGroupMemberships. Additionally it modifies the existing createAssessment API method to add a new hashed_account_id parameter along with AccountDefenderAssessment return value.

PiperOrigin-RevId: 407130991

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Nov 2 11:14:17 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: d58e602ed8a92b8d21da92543528fa5980be6811
Source-Link: googleapis/googleapis@d58e602
  • Loading branch information
yoshi-automation authored and jskeet committed Nov 3, 2021
1 parent dc23709 commit fcce878
Show file tree
Hide file tree
Showing 8 changed files with 4,855 additions and 180 deletions.

Large diffs are not rendered by default.

Expand Up @@ -16,6 +16,7 @@

using gaxgrpc = Google.Api.Gax.Grpc;
using gagr = Google.Api.Gax.ResourceNames;
using proto = Google.Protobuf;
using wkt = Google.Protobuf.WellKnownTypes;
using grpccore = Grpc.Core;
using moq = Moq;
Expand Down Expand Up @@ -43,6 +44,7 @@ public void CreateAssessmentRequestObject()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessment(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -66,6 +68,7 @@ public void CreateAssessmentRequestObject()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessmentAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Assessment>(stt::Task.FromResult(expectedResponse), null, null, null, null));
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -91,6 +94,7 @@ public void CreateAssessment()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessment(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -114,6 +118,7 @@ public void CreateAssessment()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessmentAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Assessment>(stt::Task.FromResult(expectedResponse), null, null, null, null));
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -139,6 +144,7 @@ public void CreateAssessmentResourceNames()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessment(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -162,6 +168,7 @@ public void CreateAssessmentResourceNames()
Event = new Event(),
RiskAnalysis = new RiskAnalysis(),
TokenProperties = new TokenProperties(),
AccountDefenderAssessment = new AccountDefenderAssessment(),
};
mockGrpcClient.Setup(x => x.CreateAssessmentAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Assessment>(stt::Task.FromResult(expectedResponse), null, null, null, null));
RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null);
Expand All @@ -184,6 +191,7 @@ public void AnnotateAssessmentRequestObject()
{
AnnotateAssessmentRequest.Types.Reason.InitiatedTwoFactor,
},
HashedAccountId = proto::ByteString.CopyFromUtf8("hashed_account_id016ad986"),
};
AnnotateAssessmentResponse expectedResponse = new AnnotateAssessmentResponse { };
mockGrpcClient.Setup(x => x.AnnotateAssessment(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
Expand All @@ -205,6 +213,7 @@ public void AnnotateAssessmentRequestObject()
{
AnnotateAssessmentRequest.Types.Reason.InitiatedTwoFactor,
},
HashedAccountId = proto::ByteString.CopyFromUtf8("hashed_account_id016ad986"),
};
AnnotateAssessmentResponse expectedResponse = new AnnotateAssessmentResponse { };
mockGrpcClient.Setup(x => x.AnnotateAssessmentAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<AnnotateAssessmentResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
Expand Down

0 comments on commit fcce878

Please sign in to comment.