public async stt::Task GetSystemPolicyRequestObjectAsync() { moq::Mock <SystemPolicyV1Beta1.SystemPolicyV1Beta1Client> mockGrpcClient = new moq::Mock <SystemPolicyV1Beta1.SystemPolicyV1Beta1Client>(moq::MockBehavior.Strict); GetSystemPolicyRequest request = new GetSystemPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; Policy expectedResponse = new Policy { PolicyName = PolicyName.FromProject("[PROJECT]"), AdmissionWhitelistPatterns = { new AdmissionWhitelistPattern(), }, ClusterAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, DefaultAdmissionRule = new AdmissionRule(), UpdateTime = new wkt::Timestamp(), Description = "description2cf9da67", GlobalPolicyEvaluationMode = Policy.Types.GlobalPolicyEvaluationMode.Disable, KubernetesServiceAccountAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, IstioServiceIdentityAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, KubernetesNamespaceAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, }; mockGrpcClient.Setup(x => x.GetSystemPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Policy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SystemPolicyV1Beta1Client client = new SystemPolicyV1Beta1ClientImpl(mockGrpcClient.Object, null); Policy responseCallSettings = await client.GetSystemPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Policy responseCancellationToken = await client.GetSystemPolicyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetSystemPolicyRequestObject() { moq::Mock <SystemPolicyV1Beta1.SystemPolicyV1Beta1Client> mockGrpcClient = new moq::Mock <SystemPolicyV1Beta1.SystemPolicyV1Beta1Client>(moq::MockBehavior.Strict); GetSystemPolicyRequest request = new GetSystemPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; Policy expectedResponse = new Policy { PolicyName = PolicyName.FromProject("[PROJECT]"), AdmissionWhitelistPatterns = { new AdmissionWhitelistPattern(), }, ClusterAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, DefaultAdmissionRule = new AdmissionRule(), UpdateTime = new wkt::Timestamp(), Description = "description2cf9da67", GlobalPolicyEvaluationMode = Policy.Types.GlobalPolicyEvaluationMode.Disable, KubernetesServiceAccountAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, IstioServiceIdentityAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, KubernetesNamespaceAdmissionRules = { { "key8a0b6e3c", new AdmissionRule() }, }, }; mockGrpcClient.Setup(x => x.GetSystemPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SystemPolicyV1Beta1Client client = new SystemPolicyV1Beta1ClientImpl(mockGrpcClient.Object, null); Policy response = client.GetSystemPolicy(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetSystemPolicy</summary> public void GetSystemPolicyRequestObject() { // Snippet: GetSystemPolicy(GetSystemPolicyRequest, CallSettings) // Create client SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.Create(); // Initialize request argument(s) GetSystemPolicyRequest request = new GetSystemPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; // Make the request Policy response = systemPolicyV1Beta1Client.GetSystemPolicy(request); // End snippet }
/// <summary>Snippet for GetSystemPolicyAsync</summary> public async Task GetSystemPolicyRequestObjectAsync() { // Snippet: GetSystemPolicyAsync(GetSystemPolicyRequest, CallSettings) // Additional: GetSystemPolicyAsync(GetSystemPolicyRequest, CancellationToken) // Create client SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = await SystemPolicyV1Beta1Client.CreateAsync(); // Initialize request argument(s) GetSystemPolicyRequest request = new GetSystemPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; // Make the request Policy response = await systemPolicyV1Beta1Client.GetSystemPolicyAsync(request); // End snippet }
/// <summary> /// Gets the current system policy in the specified location. /// </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 <Policy> GetSystemPolicyAsync(GetSystemPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetSystemPolicyRequest(ref request, ref callSettings); return(_callGetSystemPolicy.Async(request, callSettings)); }
/// <summary> /// Gets the current system policy in the specified location. /// </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>The RPC response.</returns> public override Policy GetSystemPolicy(GetSystemPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetSystemPolicyRequest(ref request, ref callSettings); return(_callGetSystemPolicy.Sync(request, callSettings)); }
partial void Modify_GetSystemPolicyRequest(ref GetSystemPolicyRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Gets the current system policy in the specified location. /// </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 <Policy> GetSystemPolicyAsync(GetSystemPolicyRequest request, st::CancellationToken cancellationToken) => GetSystemPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Gets the current system policy in the specified location. /// </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 <Policy> GetSystemPolicyAsync(GetSystemPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Gets the current system policy in the specified location. /// </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>The RPC response.</returns> public virtual Policy GetSystemPolicy(GetSystemPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();