Ejemplo n.º 1
0
        public void CreateInspectOperation()
        {
            // Snippet: CreateInspectOperation(InspectConfig,StorageConfig,OutputStorageConfig,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
            // Initialize request argument(s)
            InspectConfig       inspectConfig = new InspectConfig();
            StorageConfig       storageConfig = new StorageConfig();
            OutputStorageConfig outputConfig  = new OutputStorageConfig();
            // Make the request
            Operation <InspectOperationResult, InspectOperationMetadata> response =
                dlpServiceClient.CreateInspectOperation(inspectConfig, storageConfig, outputConfig);

            // Poll until the returned long-running operation is complete
            Operation <InspectOperationResult, InspectOperationMetadata> completedResponse =
                response.PollUntilCompleted();
            // 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 =
                dlpServiceClient.PollOnceCreateInspectOperation(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 void CreateInspectOperation_RequestObject()
        {
            // Snippet: CreateInspectOperation(CreateInspectOperationRequest,CallSettings)
            // Create client
            DlpServiceClient dlpServiceClient = DlpServiceClient.Create();
            // 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 =
                dlpServiceClient.CreateInspectOperation(request);

            // Poll until the returned long-running operation is complete
            Operation <InspectOperationResult, InspectOperationMetadata> completedResponse =
                response.PollUntilCompleted();
            // 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 =
                dlpServiceClient.PollOnceCreateInspectOperation(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
        }