Exemplo n.º 1
0
 /// <summary>Snippet for CreateInspectTemplate</summary>
 public void CreateInspectTemplate_RequestObject()
 {
     // Snippet: CreateInspectTemplate(CreateInspectTemplateRequest,CallSettings)
     // Create client
     DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
     // Initialize request argument(s)
     CreateInspectTemplateRequest request = new CreateInspectTemplateRequest
     {
         ParentAsOrganizationName = new OrganizationName("[ORGANIZATION]"),
     };
     // Make the request
     InspectTemplate response = dlpServiceClient.CreateInspectTemplate(request);
     // End snippet
 }
Exemplo n.º 2
0
        // [START dlp_create_inspect_template]
        public static string CreateInspectTemplate(
            string projectId,
            string templateId,
            string displayName,
            string description,
            string likelihood,
            int maxFindings,
            bool includeQuote)
        {
            DlpServiceClient client = DlpServiceClient.Create();

            var request = new CreateInspectTemplateRequest
            {
                Parent          = $"projects/{projectId}",
                InspectTemplate = new InspectTemplate
                {
                    DisplayName   = displayName,
                    Description   = description,
                    InspectConfig = new InspectConfig
                    {
                        MinLikelihood = (Likelihood)Enum.Parse(typeof(Likelihood), likelihood),
                        Limits        = new InspectConfig.Types.FindingLimits
                        {
                            MaxFindingsPerRequest = maxFindings
                        },
                        IncludeQuote = includeQuote
                    },
                },
                TemplateId = templateId
            };

            var response = client.CreateInspectTemplate(request);

            Console.WriteLine($"Successfully created template {response.Name}.");

            return(response.Name);
        }