public async Task InspectContentAsync_RequestObject()
        {
            // Snippet: InspectContentAsync(InspectContentRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            InspectContentRequest request = new InspectContentRequest
            {
                InspectConfig = new InspectConfig
                {
                    InfoTypes =
                    {
                        new InfoType
                        {
                            Name = "EMAIL_ADDRESS",
                        },
                    },
                },
                Items =
                {
                    new ContentItem
                    {
                        Type  = "text/plain",
                        Value = "My email is [email protected].",
                    },
                },
            };
            // Make the request
            InspectContentResponse response = await dlpServiceClient.InspectContentAsync(request);

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

            // Initialize request argument(s)
            PrivacyMetric privacyMetric = new PrivacyMetric();
            BigQueryTable sourceTable   = new BigQueryTable();
            // Make the request
            Operation <RiskAnalysisOperationResult, RiskAnalysisOperationMetadata> response =
                await dlpServiceClient.AnalyzeDataSourceRiskAsync(privacyMetric, sourceTable);

            // Poll until the returned long-running operation is complete
            Operation <RiskAnalysisOperationResult, RiskAnalysisOperationMetadata> completedResponse =
                await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            RiskAnalysisOperationResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <RiskAnalysisOperationResult, RiskAnalysisOperationMetadata> retrievedResponse =
                await dlpServiceClient.PollOnceAnalyzeDataSourceRiskAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                RiskAnalysisOperationResult retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        public async Task InspectContentAsync()
        {
            // Snippet: InspectContentAsync(InspectConfig,IEnumerable<ContentItem>,CallSettings)
            // Additional: InspectContentAsync(InspectConfig,IEnumerable<ContentItem>,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            InspectConfig inspectConfig = new InspectConfig
            {
                InfoTypes =
                {
                    new InfoType
                    {
                        Name = "EMAIL_ADDRESS",
                    },
                },
            };
            IEnumerable <ContentItem> items = new[]
            {
                new ContentItem
                {
                    Type  = "text/plain",
                    Value = "My email is [email protected].",
                },
            };
            // Make the request
            InspectContentResponse response = await dlpServiceClient.InspectContentAsync(inspectConfig, items);

            // End snippet
        }
        public async Task CreateInspectOperationAsync_RequestObject()
        {
            // Snippet: CreateInspectOperationAsync(CreateInspectOperationRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateInspectOperationRequest request = new CreateInspectOperationRequest
            {
                InspectConfig = new InspectConfig
                {
                    InfoTypes =
                    {
                        new InfoType
                        {
                            Name = "EMAIL_ADDRESS",
                        },
                    },
                },
                StorageConfig = new StorageConfig
                {
                    CloudStorageOptions = new CloudStorageOptions
                    {
                        FileSet = new CloudStorageOptions.Types.FileSet
                        {
                            Url = "gs://example_bucket/example_file.png",
                        },
                    },
                },
                OutputConfig = new OutputStorageConfig(),
            };
            // Make the request
            Operation <InspectOperationResult, InspectOperationMetadata> response =
                await dlpServiceClient.CreateInspectOperationAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <InspectOperationResult, InspectOperationMetadata> completedResponse =
                await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            InspectOperationResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <InspectOperationResult, InspectOperationMetadata> retrievedResponse =
                await dlpServiceClient.PollOnceCreateInspectOperationAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                InspectOperationResult retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        public async Task ListInspectFindingsAsync()
        {
            // Snippet: ListInspectFindingsAsync(ResultName,CallSettings)
            // Additional: ListInspectFindingsAsync(ResultName,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            ResultName name = new ResultName("[RESULT]");
            // Make the request
            ListInspectFindingsResponse response = await dlpServiceClient.ListInspectFindingsAsync(name);

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

            // Initialize request argument(s)
            GetInspectTemplateRequest request = new GetInspectTemplateRequest();
            // Make the request
            InspectTemplate response = await dlpServiceClient.GetInspectTemplateAsync(request);

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

            // Initialize request argument(s)
            ListInfoTypesRequest request = new ListInfoTypesRequest();
            // Make the request
            ListInfoTypesResponse response = await dlpServiceClient.ListInfoTypesAsync(request);

            // End snippet
        }
        public async Task ListRootCategoriesAsync()
        {
            // Snippet: ListRootCategoriesAsync(string,CallSettings)
            // Additional: ListRootCategoriesAsync(string,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            string languageCode = "en";
            // Make the request
            ListRootCategoriesResponse response = await dlpServiceClient.ListRootCategoriesAsync(languageCode);

            // End snippet
        }
Ejemplo n.º 9
0
        public async Task InspectContentAsync()
        {
            // Snippet: InspectContentAsync(InspectConfig,IEnumerable<ContentItem>,CallSettings)
            // Additional: InspectContentAsync(InspectConfig,IEnumerable<ContentItem>,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            InspectConfig             inspectConfig = new InspectConfig();
            IEnumerable <ContentItem> items         = new List <ContentItem>();
            // Make the request
            InspectContentResponse response = await dlpServiceClient.InspectContentAsync(inspectConfig, items);

            // End snippet
        }
Ejemplo n.º 10
0
        public async Task ListRootCategoriesAsync_RequestObject()
        {
            // Snippet: ListRootCategoriesAsync(ListRootCategoriesRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListRootCategoriesRequest request = new ListRootCategoriesRequest
            {
                LanguageCode = "en",
            };
            // Make the request
            ListRootCategoriesResponse response = await dlpServiceClient.ListRootCategoriesAsync(request);

            // End snippet
        }
Ejemplo n.º 11
0
        public async Task ListInspectFindingsAsync_RequestObject()
        {
            // Snippet: ListInspectFindingsAsync(ListInspectFindingsRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListInspectFindingsRequest request = new ListInspectFindingsRequest
            {
                ResultName = new ResultName("[RESULT]"),
            };
            // Make the request
            ListInspectFindingsResponse response = await dlpServiceClient.ListInspectFindingsAsync(request);

            // End snippet
        }
Ejemplo n.º 12
0
        /// <summary>Snippet for ListJobTriggersAsync</summary>
        public async Task ListJobTriggersAsync_RequestObject()
        {
            // Snippet: ListJobTriggersAsync(ListJobTriggersRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListJobTriggersRequest request = new ListJobTriggersRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListJobTriggersResponse, JobTrigger> response =
                dlpServiceClient.ListJobTriggersAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((JobTrigger item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListJobTriggersResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (JobTrigger item in page)
                {
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <JobTrigger> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (JobTrigger item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Ejemplo n.º 13
0
        /// <summary>Snippet for UpdateInspectTemplateAsync</summary>
        public async Task UpdateInspectTemplateAsync_RequestObject()
        {
            // Snippet: UpdateInspectTemplateAsync(UpdateInspectTemplateRequest,CallSettings)
            // Additional: UpdateInspectTemplateAsync(UpdateInspectTemplateRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateInspectTemplateRequest request = new UpdateInspectTemplateRequest
            {
                InspectTemplateNameOneof = InspectTemplateNameOneof.From(new OrganizationInspectTemplateName("[ORGANIZATION]", "[INSPECT_TEMPLATE]")),
            };
            // Make the request
            InspectTemplate response = await dlpServiceClient.UpdateInspectTemplateAsync(request);

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

            // Initialize request argument(s)
            DeleteJobTriggerRequest request = new DeleteJobTriggerRequest
            {
                ProjectJobTriggerName = new ProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]"),
            };
            // Make the request
            await dlpServiceClient.DeleteJobTriggerAsync(request);

            // End snippet
        }
Ejemplo n.º 15
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
        }
Ejemplo n.º 16
0
        /// <summary>Snippet for DeleteDeidentifyTemplateAsync</summary>
        public async Task DeleteDeidentifyTemplateAsync_RequestObject()
        {
            // Snippet: DeleteDeidentifyTemplateAsync(DeleteDeidentifyTemplateRequest,CallSettings)
            // Additional: DeleteDeidentifyTemplateAsync(DeleteDeidentifyTemplateRequest,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteDeidentifyTemplateRequest request = new DeleteDeidentifyTemplateRequest
            {
                DeidentifyTemplateNameOneof = DeidentifyTemplateNameOneof.From(new OrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")),
            };
            // Make the request
            await dlpServiceClient.DeleteDeidentifyTemplateAsync(request);

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

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

            // End snippet
        }
Ejemplo n.º 18
0
        public async Task InspectContentAsync_RequestObject()
        {
            // Snippet: InspectContentAsync(InspectContentRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            InspectContentRequest request = new InspectContentRequest
            {
                InspectConfig = new InspectConfig(),
                Items         = { },
            };
            // Make the request
            InspectContentResponse response = await dlpServiceClient.InspectContentAsync(request);

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

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

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

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

            // End snippet
        }
Ejemplo n.º 21
0
        public async Task CreateInspectOperationAsync()
        {
            // Snippet: CreateInspectOperationAsync(InspectConfig,StorageConfig,OutputStorageConfig,CallSettings)
            // Additional: CreateInspectOperationAsync(InspectConfig,StorageConfig,OutputStorageConfig,CancellationToken)
            // Create client
            DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync();

            // Initialize request argument(s)
            InspectConfig       inspectConfig = new InspectConfig();
            StorageConfig       storageConfig = new StorageConfig();
            OutputStorageConfig outputConfig  = new OutputStorageConfig();
            // Make the request
            Operation <InspectOperationResult, InspectOperationMetadata> response =
                await dlpServiceClient.CreateInspectOperationAsync(inspectConfig, storageConfig, outputConfig);

            // Poll until the returned long-running operation is complete
            Operation <InspectOperationResult, InspectOperationMetadata> completedResponse =
                await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            InspectOperationResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <InspectOperationResult, InspectOperationMetadata> retrievedResponse =
                await dlpServiceClient.PollOnceCreateInspectOperationAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                InspectOperationResult retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }