コード例 #1
0
        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
        }
コード例 #2
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
        }