Ejemplo n.º 1
0
 /// <summary>Snippet for CreateDlpJob</summary>
 public void CreateDlpJob_RequestObject()
 {
     // Snippet: CreateDlpJob(CreateDlpJobRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     CreateDlpJobRequest request = new CreateDlpJobRequest
     {
         ParentAsProjectName = new ProjectName("[PROJECT]"),
     };
     // Make the request
     DlpJob response = dlpServiceClient.CreateDlpJob(request);
     // End snippet
 }
Ejemplo n.º 2
0
 /// <summary>Snippet for GetDlpJob</summary>
 public void GetDlpJob_RequestObject()
 {
     // Snippet: GetDlpJob(GetDlpJobRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     GetDlpJobRequest request = new GetDlpJobRequest
     {
         DlpJobName = new DlpJobName("[PROJECT]", "[DLP_JOB]"),
     };
     // Make the request
     DlpJob response = dlpServiceClient.GetDlpJob(request);
     // End snippet
 }
Ejemplo n.º 3
0
        /// <summary>Snippet for GetDlpJobAsync</summary>
        public async Task GetDlpJobAsync_RequestObject()
        {
            // Snippet: GetDlpJobAsync(GetDlpJobRequest,CallSettings)
            // Additional: GetDlpJobAsync(GetDlpJobRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetDlpJobRequest request = new GetDlpJobRequest
            {
                DlpJobName = new DlpJobName("[PROJECT]", "[DLP_JOB]"),
            };
            // Make the request
            DlpJob response = await dlpServiceClient.GetDlpJobAsync(request);

            // End snippet
        }
Ejemplo n.º 4
0
        /// <summary>Snippet for CreateDlpJobAsync</summary>
        public async Task CreateDlpJobAsync_RequestObject()
        {
            // Snippet: CreateDlpJobAsync(CreateDlpJobRequest,CallSettings)
            // Additional: CreateDlpJobAsync(CreateDlpJobRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateDlpJobRequest request = new CreateDlpJobRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
            };
            // Make the request
            DlpJob response = await dlpServiceClient.CreateDlpJobAsync(request);

            // End snippet
        }
        public async Task GetDlpJobAsync()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            GetDlpJobRequest request = new GetDlpJobRequest
            {
                DlpJobName = new DlpJobName("[PROJECT]", "[DLP_JOB]"),
            };
            DlpJob expectedResponse = new DlpJob
            {
                Name           = "name2-1052831874",
                JobTriggerName = "jobTriggerName1819490804",
            };

            mockGrpcClient.Setup(x => x.GetDlpJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <DlpJob>(Task.FromResult(expectedResponse), null, null, null, null));
            DlpServiceClient client   = new DlpServiceClientImpl(mockGrpcClient.Object, null);
            DlpJob           response = await client.GetDlpJobAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetDlpJob()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            GetDlpJobRequest request = new GetDlpJobRequest
            {
                DlpJobName = new DlpJobName("[PROJECT]", "[DLP_JOB]"),
            };
            DlpJob expectedResponse = new DlpJob
            {
                Name           = "name2-1052831874",
                JobTriggerName = "jobTriggerName1819490804",
            };

            mockGrpcClient.Setup(x => x.GetDlpJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            DlpServiceClient client   = new DlpServiceClientImpl(mockGrpcClient.Object, null);
            DlpJob           response = client.GetDlpJob(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void CreateDlpJob()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            CreateDlpJobRequest request = new CreateDlpJobRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
            };
            DlpJob expectedResponse = new DlpJob
            {
                Name           = "name3373707",
                JobTriggerName = "jobTriggerName1819490804",
            };

            mockGrpcClient.Setup(x => x.CreateDlpJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            DlpServiceClient client   = new DlpServiceClientImpl(mockGrpcClient.Object, null);
            DlpJob           response = client.CreateDlpJob(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }