Ejemplo n.º 1
0
 /// <summary>Snippet for CreateDeidentifyTemplate</summary>
 public void CreateDeidentifyTemplate_RequestObject()
 {
     // Snippet: CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     CreateDeidentifyTemplateRequest request = new CreateDeidentifyTemplateRequest
     {
         ParentAsOrganizationName = new OrganizationName("[ORGANIZATION]"),
     };
     // Make the request
     DeidentifyTemplate response = dlpServiceClient.CreateDeidentifyTemplate(request);
     // End snippet
 }
Ejemplo n.º 2
0
        /// <summary>Snippet for CreateDeidentifyTemplateAsync</summary>
        public async Task CreateDeidentifyTemplateAsync_RequestObject()
        {
            // Snippet: CreateDeidentifyTemplateAsync(CreateDeidentifyTemplateRequest,CallSettings)
            // Additional: CreateDeidentifyTemplateAsync(CreateDeidentifyTemplateRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateDeidentifyTemplateRequest request = new CreateDeidentifyTemplateRequest
            {
                ParentAsOrganizationName = new OrganizationName("[ORGANIZATION]"),
            };
            // Make the request
            DeidentifyTemplate response = await dlpServiceClient.CreateDeidentifyTemplateAsync(request);

            // End snippet
        }
        public async Task CreateDeidentifyTemplateAsync()
        {
            Mock <DlpService.DlpServiceClient> mockGrpcClient = new Mock <DlpService.DlpServiceClient>(MockBehavior.Strict);
            CreateDeidentifyTemplateRequest    request        = new CreateDeidentifyTemplateRequest
            {
                ParentAsOrganizationName = new OrganizationName("[ORGANIZATION]"),
            };
            DeidentifyTemplate expectedResponse = new DeidentifyTemplate
            {
                Name        = "name3373707",
                DisplayName = "displayName1615086568",
                Description = "description-1724546052",
            };

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

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