public void AnalyzeIamPolicyRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse { MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), ServiceAccountImpersonationAnalysis = { new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), }, FullyExplored = false, NonCriticalErrors = { new IamPolicyAnalysisResult.Types.AnalysisState(), }, }; mockGrpcClient.Setup(x => x.AnalyzeIamPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); AnalyzeIamPolicyResponse response = client.AnalyzeIamPolicy(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task AnalyzeIamPolicyRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse { MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), ServiceAccountImpersonationAnalysis = { new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), }, FullyExplored = false, NonCriticalErrors = { new IamPolicyAnalysisResult.Types.AnalysisState(), }, }; mockGrpcClient.Setup(x => x.AnalyzeIamPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnalyzeIamPolicyResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); AnalyzeIamPolicyResponse responseCallSettings = await client.AnalyzeIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnalyzeIamPolicyResponse responseCancellationToken = await client.AnalyzeIamPolicyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public AnalyzeIamPolicyResponse AnalyzeIamPolicy(string scope, string fullResourceName) { // Create the client. AssetServiceClient client = AssetServiceClient.Create(); // Build the request. AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery { Scope = scope, ResourceSelector = new IamPolicyAnalysisQuery.Types.ResourceSelector { FullResourceName = fullResourceName, }, Options = new IamPolicyAnalysisQuery.Types.Options { ExpandGroups = true, OutputGroupEdges = true, }, }, }; // Call the API. AnalyzeIamPolicyResponse response = client.AnalyzeIamPolicy(request); // Return the result. return(response); }
/// <summary>Snippet for AnalyzeIamPolicy</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void AnalyzeIamPolicyRequestObject() { // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), ExecutionTimeout = new Duration(), }; // Make the request AnalyzeIamPolicyResponse response = assetServiceClient.AnalyzeIamPolicy(request); }
/// <summary>Snippet for AnalyzeIamPolicyAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task AnalyzeIamPolicyRequestObjectAsync() { // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; // Make the request AnalyzeIamPolicyResponse response = await assetServiceClient.AnalyzeIamPolicyAsync(request); }
/// <summary>Snippet for AnalyzeIamPolicy</summary> public void AnalyzeIamPolicyRequestObject() { // Snippet: AnalyzeIamPolicy(AnalyzeIamPolicyRequest, CallSettings) // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; // Make the request AnalyzeIamPolicyResponse response = assetServiceClient.AnalyzeIamPolicy(request); // End snippet }
/// <summary>Snippet for AnalyzeIamPolicyAsync</summary> public async Task AnalyzeIamPolicyRequestObjectAsync() { // Snippet: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CallSettings) // Additional: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CancellationToken) // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), ExecutionTimeout = new Duration(), }; // Make the request AnalyzeIamPolicyResponse response = await assetServiceClient.AnalyzeIamPolicyAsync(request); // End snippet }
/// <summary> /// Analyzes IAM policies based on the specified request. Returns /// a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <AnalyzeIamPolicyResponse> AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_AnalyzeIamPolicyRequest(ref request, ref callSettings); return(_callAnalyzeIamPolicy.Async(request, callSettings)); }
partial void Modify_AnalyzeIamPolicyRequest(ref AnalyzeIamPolicyRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Analyzes IAM policies based on the specified request. Returns /// a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <AnalyzeIamPolicyResponse> AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest request, st::CancellationToken cancellationToken) => AnalyzeIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Analyzes IAM policies based on the specified request. Returns /// a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <AnalyzeIamPolicyResponse> AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();