コード例 #1
0
        public void Intro()
        {
            // Sample: Intro
            DlpServiceClient client = DlpServiceClient.Create();
            var request             = new RedactContentRequest
            {
                Items =
                {
                    new ContentItem
                    {
                        Type  = "text/plain",
                        Value = "Hi! My phone number is 555-1234-567. Please call me!"
                    }
                },
                ReplaceConfigs = { new ReplaceConfig {
                                       ReplaceWith = "(Redacted)"
                                   } }
            };
            var response = client.RedactContent(request);
            var item     = response.Items[0];

            Console.WriteLine(item.Value);
            // End sample
            Assert.Equal("Hi! My phone number is (Redacted). Please call me!", item.Value);
        }
コード例 #2
0
 /// <summary>Snippet for RedactContent</summary>
 public void RedactContent_RequestObject()
 {
     // Snippet: RedactContent(RedactContentRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     RedactContentRequest request = new RedactContentRequest
     {
         InspectConfig = new InspectConfig
         {
             InfoTypes =
             {
                 new InfoType
                 {
                     Name = "EMAIL_ADDRESS",
                 },
             },
         },
         Items =
         {
             new ContentItem
             {
                 Type  = "text/plain",
                 Value = "My email is [email protected].",
             },
         },
     };
     // Make the request
     RedactContentResponse response = dlpServiceClient.RedactContent(request);
     // End snippet
 }
コード例 #3
0
 public void RedactContent_RequestObject()
 {
     // Snippet: RedactContent(RedactContentRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     RedactContentRequest request = new RedactContentRequest
     {
         InspectConfig  = new InspectConfig(),
         Items          = { },
         ReplaceConfigs = { },
     };
     // Make the request
     RedactContentResponse response = dlpServiceClient.RedactContent(request);
     // End snippet
 }
コード例 #4
0
        public async Task RedactContentAsync_RequestObject()
        {
            // Snippet: RedactContentAsync(RedactContentRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            RedactContentRequest request = new RedactContentRequest
            {
                InspectConfig = new InspectConfig
                {
                    InfoTypes =
                    {
                        new InfoType
                        {
                            Name = "EMAIL_ADDRESS",
                        },
                    },
                },
                Items =
                {
                    new ContentItem
                    {
                        Type  = "text/plain",
                        Value = "My email is [email protected].",
                    },
                },
                ReplaceConfigs =
                {
                    new RedactContentRequest.Types.ReplaceConfig
                    {
                        InfoType = new InfoType
                        {
                            Name = "EMAIL_ADDRESS",
                        },
                        ReplaceWith = "REDACTED",
                    },
                },
            };
            // Make the request
            RedactContentResponse response = await dlpServiceClient.RedactContentAsync(request);

            // End snippet
        }