public async stt::Task SetIamPolicyRequestObjectAsync() { moq::Mock <Organizations.OrganizationsClient> mockGrpcClient = new moq::Mock <Organizations.OrganizationsClient>(moq::MockBehavior.Strict); gciv::SetIamPolicyRequest request = new gciv::SetIamPolicyRequest { ResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), Policy = new gciv::Policy(), }; gciv::Policy expectedResponse = new gciv::Policy { Version = 271578922, Etag = proto::ByteString.CopyFromUtf8("etage8ad7218"), Bindings = { new gciv::Binding(), }, }; mockGrpcClient.Setup(x => x.SetIamPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gciv::Policy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); OrganizationsClient client = new OrganizationsClientImpl(mockGrpcClient.Object, null); gciv::Policy responseCallSettings = await client.SetIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gciv::Policy responseCancellationToken = await client.SetIamPolicyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void SetIamPolicyRequestObject() { moq::Mock <Organizations.OrganizationsClient> mockGrpcClient = new moq::Mock <Organizations.OrganizationsClient>(moq::MockBehavior.Strict); gciv::SetIamPolicyRequest request = new gciv::SetIamPolicyRequest { ResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), Policy = new gciv::Policy(), }; gciv::Policy expectedResponse = new gciv::Policy { Version = 271578922, Etag = proto::ByteString.CopyFromUtf8("etage8ad7218"), Bindings = { new gciv::Binding(), }, }; mockGrpcClient.Setup(x => x.SetIamPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); OrganizationsClient client = new OrganizationsClientImpl(mockGrpcClient.Object, null); gciv::Policy response = client.SetIamPolicy(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Sets the access control policy for an Identity-Aware Proxy protected /// resource. Replaces any existing policy. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// </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 <gciv::Policy> SetIamPolicyAsync(gciv::SetIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_SetIamPolicyRequest(ref request, ref callSettings); return(_callSetIamPolicy.Async(request, callSettings)); }
/// <summary> /// Sets the access control policy for an Identity-Aware Proxy protected /// resource. Replaces any existing policy. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// </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 gciv::Policy SetIamPolicy(gciv::SetIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_SetIamPolicyRequest(ref request, ref callSettings); return(_callSetIamPolicy.Sync(request, callSettings)); }
partial void Modify_SetIamPolicyRequest(ref gciv::SetIamPolicyRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Sets the access control policy for an Identity-Aware Proxy protected /// resource. Replaces any existing policy. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// </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 <gciv::Policy> SetIamPolicyAsync(gciv::SetIamPolicyRequest request, st::CancellationToken cancellationToken) => SetIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Sets the access control policy for an Identity-Aware Proxy protected /// resource. Replaces any existing policy. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// </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 <gciv::Policy> SetIamPolicyAsync(gciv::SetIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Sets the access control policy for an Identity-Aware Proxy protected /// resource. Replaces any existing policy. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// </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 gciv::Policy SetIamPolicy(gciv::SetIamPolicyRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();