diff --git a/google-cloud-chronicle-v1/.owlbot-manifest.json b/google-cloud-chronicle-v1/.owlbot-manifest.json index de63fa3a5184..92c089bb028e 100644 --- a/google-cloud-chronicle-v1/.owlbot-manifest.json +++ b/google-cloud-chronicle-v1/.owlbot-manifest.json @@ -79,6 +79,15 @@ "lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest/client.rb", "lib/google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest/service_stub.rb", "lib/google/cloud/chronicle/v1/featured_content_native_dashboard_services_pb.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_pb.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/client.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/credentials.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/paths.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/rest.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/rest/client.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_service/rest/service_stub.rb", + "lib/google/cloud/chronicle/v1/findings_refinement_services_pb.rb", "lib/google/cloud/chronicle/v1/instance_pb.rb", "lib/google/cloud/chronicle/v1/instance_service.rb", "lib/google/cloud/chronicle/v1/instance_service/client.rb", @@ -141,6 +150,7 @@ "proto_docs/google/cloud/chronicle/v1/entity.rb", "proto_docs/google/cloud/chronicle/v1/featured_content_metadata.rb", "proto_docs/google/cloud/chronicle/v1/featured_content_native_dashboard.rb", + "proto_docs/google/cloud/chronicle/v1/findings_refinement.rb", "proto_docs/google/cloud/chronicle/v1/instance.rb", "proto_docs/google/cloud/chronicle/v1/native_dashboard.rb", "proto_docs/google/cloud/chronicle/v1/reference_list.rb", @@ -196,6 +206,15 @@ "snippets/featured_content_native_dashboard_service/get_featured_content_native_dashboard.rb", "snippets/featured_content_native_dashboard_service/install_featured_content_native_dashboard.rb", "snippets/featured_content_native_dashboard_service/list_featured_content_native_dashboards.rb", + "snippets/findings_refinement_service/compute_all_findings_refinement_activities.rb", + "snippets/findings_refinement_service/compute_findings_refinement_activity.rb", + "snippets/findings_refinement_service/create_findings_refinement.rb", + "snippets/findings_refinement_service/get_findings_refinement.rb", + "snippets/findings_refinement_service/get_findings_refinement_deployment.rb", + "snippets/findings_refinement_service/list_all_findings_refinement_deployments.rb", + "snippets/findings_refinement_service/list_findings_refinements.rb", + "snippets/findings_refinement_service/update_findings_refinement.rb", + "snippets/findings_refinement_service/update_findings_refinement_deployment.rb", "snippets/instance_service/get_instance.rb", "snippets/native_dashboard_service/add_chart.rb", "snippets/native_dashboard_service/create_native_dashboard.rb", @@ -250,6 +269,9 @@ "test/google/cloud/chronicle/v1/featured_content_native_dashboard_service_paths_test.rb", "test/google/cloud/chronicle/v1/featured_content_native_dashboard_service_rest_test.rb", "test/google/cloud/chronicle/v1/featured_content_native_dashboard_service_test.rb", + "test/google/cloud/chronicle/v1/findings_refinement_service_paths_test.rb", + "test/google/cloud/chronicle/v1/findings_refinement_service_rest_test.rb", + "test/google/cloud/chronicle/v1/findings_refinement_service_test.rb", "test/google/cloud/chronicle/v1/instance_service_paths_test.rb", "test/google/cloud/chronicle/v1/instance_service_rest_test.rb", "test/google/cloud/chronicle/v1/instance_service_test.rb", diff --git a/google-cloud-chronicle-v1/gapic_metadata.json b/google-cloud-chronicle-v1/gapic_metadata.json index 344ecf59ea29..95799ff07857 100644 --- a/google-cloud-chronicle-v1/gapic_metadata.json +++ b/google-cloud-chronicle-v1/gapic_metadata.json @@ -337,6 +337,60 @@ } } }, + "FindingsRefinementService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client", + "rpcs": { + "GetFindingsRefinement": { + "methods": [ + "get_findings_refinement" + ] + }, + "ListFindingsRefinements": { + "methods": [ + "list_findings_refinements" + ] + }, + "CreateFindingsRefinement": { + "methods": [ + "create_findings_refinement" + ] + }, + "UpdateFindingsRefinement": { + "methods": [ + "update_findings_refinement" + ] + }, + "GetFindingsRefinementDeployment": { + "methods": [ + "get_findings_refinement_deployment" + ] + }, + "UpdateFindingsRefinementDeployment": { + "methods": [ + "update_findings_refinement_deployment" + ] + }, + "ListAllFindingsRefinementDeployments": { + "methods": [ + "list_all_findings_refinement_deployments" + ] + }, + "ComputeFindingsRefinementActivity": { + "methods": [ + "compute_findings_refinement_activity" + ] + }, + "ComputeAllFindingsRefinementActivities": { + "methods": [ + "compute_all_findings_refinement_activities" + ] + } + } + } + } + }, "InstanceService": { "clients": { "grpc": { diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1.rb index c6f6e14d0f61..0fdd59ead335 100644 --- a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1.rb +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1.rb @@ -24,6 +24,7 @@ require "google/cloud/chronicle/v1/entity_service" require "google/cloud/chronicle/v1/native_dashboard_service" require "google/cloud/chronicle/v1/featured_content_native_dashboard_service" +require "google/cloud/chronicle/v1/findings_refinement_service" require "google/cloud/chronicle/v1/instance_service" require "google/cloud/chronicle/v1/reference_list_service" require "google/cloud/chronicle/v1/rule_service" diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_pb.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_pb.rb new file mode 100644 index 000000000000..df98373c42b5 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_pb.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/chronicle/v1/findings_refinement.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' +require 'google/type/interval_pb' + + +descriptor_data = "\n3google/cloud/chronicle/v1/findings_refinement.proto\x12\x19google.cloud.chronicle.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1agoogle/type/interval.proto\"\xd8\x03\n\x12\x46indingsRefinement\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12?\n\x04type\x18\x03 \x01(\x0e\x32\x31.google.cloud.chronicle.v1.FindingsRefinementType\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\r\n\x05query\x18\x07 \x01(\t\x12\x46\n\x0foutcome_filters\x18\x08 \x03(\x0b\x32(.google.cloud.chronicle.v1.OutcomeFilterB\x03\xe0\x41\x01:\x99\x01\xea\x41\x95\x01\n+chronicle.googleapis.com/FindingsRefinement\x12\x66projects/{project}/locations/{location}/instances/{instance}/findingsRefinements/{findings_refinement}\"\xc1\x03\n\x1c\x46indingsRefinementDeployment\x12\x63\n\x1f\x64\x65tection_exclusion_application\x18\x05 \x01(\x0b\x32\x38.google.cloud.chronicle.v1.DetectionExclusionApplicationH\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x07\x65nabled\x18\x02 \x01(\x08\x12\x10\n\x08\x61rchived\x18\x03 \x01(\x08\x12\x34\n\x0bupdate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xae\x01\xea\x41\xaa\x01\n5chronicle.googleapis.com/FindingsRefinementDeployment\x12qprojects/{project}/locations/{location}/instances/{instance}/findingsRefinements/{findings_refinement}/deploymentB\x1f\n\x1d\x46indingsRefinementApplication\"\xb4\x02\n\x1d\x44\x65tectionExclusionApplication\x12G\n\x11\x63urated_rule_sets\x18\x01 \x03(\tB,\xfa\x41)\n\'chronicle.googleapis.com/CuratedRuleSet\x12@\n\rcurated_rules\x18\x02 \x03(\tB)\xfa\x41&\n$chronicle.googleapis.com/CuratedRule\x12\x34\n\x05rules\x18\x03 \x03(\tB%\xe0\x41\x01\xfa\x41\x1f\n\x1d\x63hronicle.googleapis.com/Rule\x12R\n\x19\x64\x65leted_curated_rule_sets\x18\x04 \x03(\tB/\xe0\x41\x03\xfa\x41)\n\'chronicle.googleapis.com/CuratedRuleSet\"\xd9\x01\n\x1a\x46indingsRefinementActivity\x12]\n\x1c\x64\x65tection_exclusion_activity\x18\x02 \x01(\x0b\x32\x35.google.cloud.chronicle.v1.DetectionExclusionActivityH\x00\x12P\n\x13\x66indings_refinement\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+chronicle.googleapis.com/FindingsRefinementB\n\n\x08\x41\x63tivity\"\xb4\x04\n\x1a\x44\x65tectionExclusionActivity\x12\x89\x01\n\'detection_exclusion_detector_activities\x18\x01 \x03(\x0b\x32X.google.cloud.chronicle.v1.DetectionExclusionActivity.DetectionExclusionDetectorActivity\x1a\x89\x03\n\"DetectionExclusionDetectorActivity\x12\x41\n\x0c\x63urated_rule\x18\x01 \x01(\tB)\xfa\x41&\n$chronicle.googleapis.com/CuratedRuleH\x00\x12H\n\x10\x63urated_rule_set\x18\x02 \x01(\tB,\xfa\x41)\n\'chronicle.googleapis.com/CuratedRuleSetH\x00\x12\x32\n\x04rule\x18\x05 \x01(\tB\"\xfa\x41\x1f\n\x1d\x63hronicle.googleapis.com/RuleH\x00\x12P\n\x18\x64\x65leted_curated_rule_set\x18\x06 \x01(\tB,\xfa\x41)\n\'chronicle.googleapis.com/CuratedRuleSetH\x00\x12 \n\x18\x65xcluded_detection_count\x18\x03 \x01(\x03\x12\x1d\n\x15total_detection_count\x18\x04 \x01(\x03\x42\x0f\n\rdetector_name\"a\n\x1cGetFindingsRefinementRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+chronicle.googleapis.com/FindingsRefinement\"\x8c\x01\n\x1eListFindingsRefinementsRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+chronicle.googleapis.com/FindingsRefinement\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x87\x01\n\x1fListFindingsRefinementsResponse\x12K\n\x14\x66indings_refinements\x18\x01 \x03(\x0b\x32-.google.cloud.chronicle.v1.FindingsRefinement\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xb7\x01\n\x1f\x43reateFindingsRefinementRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\x12+chronicle.googleapis.com/FindingsRefinement\x12O\n\x13\x66indings_refinement\x18\x02 \x01(\x0b\x32-.google.cloud.chronicle.v1.FindingsRefinementB\x03\xe0\x41\x02\"\xa8\x01\n\x1fUpdateFindingsRefinementRequest\x12O\n\x13\x66indings_refinement\x18\x01 \x01(\x0b\x32-.google.cloud.chronicle.v1.FindingsRefinementB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"u\n&GetFindingsRefinementDeploymentRequest\x12K\n\x04name\x18\x01 \x01(\tB=\xe0\x41\x02\xfa\x41\x37\n5chronicle.googleapis.com/FindingsRefinementDeployment\"\xc7\x01\n)UpdateFindingsRefinementDeploymentRequest\x12\x64\n\x1e\x66indings_refinement_deployment\x18\x01 \x01(\x0b\x32\x37.google.cloud.chronicle.v1.FindingsRefinementDeploymentB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\"\xa1\x01\n+ListAllFindingsRefinementDeploymentsRequest\x12;\n\x08instance\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!chronicle.googleapis.com/Instance\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t\"\xad\x01\n,ListAllFindingsRefinementDeploymentsResponse\x12\x64\n#all_findings_refinement_deployments\x18\x01 \x03(\x0b\x32\x37.google.cloud.chronicle.v1.FindingsRefinementDeployment\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x87\x02\n\rOutcomeFilter\x12\x1d\n\x10outcome_variable\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1a\n\routcome_value\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12W\n\x17outcome_filter_operator\x18\x03 \x01(\x0e\x32\x31.google.cloud.chronicle.v1.OutcomeFilter.OperatorB\x03\xe0\x41\x02\"b\n\x08Operator\x12\x18\n\x14OPERATOR_UNSPECIFIED\x10\x00\x12\t\n\x05\x45QUAL\x10\x01\x12\x0c\n\x08\x43ONTAINS\x10\x02\x12\x11\n\rMATCHES_REGEX\x10\x03\x12\x10\n\x0cMATCHES_CIDR\x10\x04\"\x96\x01\n(ComputeFindingsRefinementActivityRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+chronicle.googleapis.com/FindingsRefinement\x12\'\n\x08interval\x18\x02 \x01(\x0b\x32\x15.google.type.Interval\"t\n)ComputeFindingsRefinementActivityResponse\x12G\n\x08\x61\x63tivity\x18\x01 \x01(\x0b\x32\x35.google.cloud.chronicle.v1.FindingsRefinementActivity\"\x95\x01\n-ComputeAllFindingsRefinementActivitiesRequest\x12;\n\x08instance\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!chronicle.googleapis.com/Instance\x12\'\n\x08interval\x18\x02 \x01(\x0b\x32\x15.google.type.Interval\"{\n.ComputeAllFindingsRefinementActivitiesResponse\x12I\n\nactivities\x18\x01 \x03(\x0b\x32\x35.google.cloud.chronicle.v1.FindingsRefinementActivity*[\n\x16\x46indingsRefinementType\x12(\n$FINDINGS_REFINEMENT_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44\x45TECTION_EXCLUSION\x10\x01\x32\x99\x15\n\x19\x46indingsRefinementService\x12\xd3\x01\n\x15GetFindingsRefinement\x12\x37.google.cloud.chronicle.v1.GetFindingsRefinementRequest\x1a-.google.cloud.chronicle.v1.FindingsRefinement\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45\x12\x43/v1/{name=projects/*/locations/*/instances/*/findingsRefinements/*}\x12\xe6\x01\n\x17ListFindingsRefinements\x12\x39.google.cloud.chronicle.v1.ListFindingsRefinementsRequest\x1a:.google.cloud.chronicle.v1.ListFindingsRefinementsResponse\"T\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x45\x12\x43/v1/{parent=projects/*/locations/*/instances/*}/findingsRefinements\x12\x84\x02\n\x18\x43reateFindingsRefinement\x12:.google.cloud.chronicle.v1.CreateFindingsRefinementRequest\x1a-.google.cloud.chronicle.v1.FindingsRefinement\"}\xda\x41\x1aparent,findings_refinement\x82\xd3\xe4\x93\x02Z\"C/v1/{parent=projects/*/locations/*/instances/*}/findingsRefinements:\x13\x66indings_refinement\x12\x9e\x02\n\x18UpdateFindingsRefinement\x12:.google.cloud.chronicle.v1.UpdateFindingsRefinementRequest\x1a-.google.cloud.chronicle.v1.FindingsRefinement\"\x96\x01\xda\x41\x1f\x66indings_refinement,update_mask\x82\xd3\xe4\x93\x02n2W/v1/{findings_refinement.name=projects/*/locations/*/instances/*/findingsRefinements/*}:\x13\x66indings_refinement\x12\xfc\x01\n\x1fGetFindingsRefinementDeployment\x12\x41.google.cloud.chronicle.v1.GetFindingsRefinementDeploymentRequest\x1a\x37.google.cloud.chronicle.v1.FindingsRefinementDeployment\"]\xda\x41\x04name\x82\xd3\xe4\x93\x02P\x12N/v1/{name=projects/*/locations/*/instances/*/findingsRefinements/*/deployment}\x12\xe9\x02\n\"UpdateFindingsRefinementDeployment\x12\x44.google.cloud.chronicle.v1.UpdateFindingsRefinementDeploymentRequest\x1a\x37.google.cloud.chronicle.v1.FindingsRefinementDeployment\"\xc3\x01\xda\x41*findings_refinement_deployment,update_mask\x82\xd3\xe4\x93\x02\x8f\x01\x32m/v1/{findings_refinement_deployment.name=projects/*/locations/*/instances/*/findingsRefinements/*/deployment}:\x1e\x66indings_refinement_deployment\x12\xa2\x02\n$ListAllFindingsRefinementDeployments\x12\x46.google.cloud.chronicle.v1.ListAllFindingsRefinementDeploymentsRequest\x1aG.google.cloud.chronicle.v1.ListAllFindingsRefinementDeploymentsResponse\"i\xda\x41\x08instance\x82\xd3\xe4\x93\x02X\x12V/v1/{instance=projects/*/locations/*/instances/*}:listAllFindingsRefinementDeployments\x12\xa7\x02\n!ComputeFindingsRefinementActivity\x12\x43.google.cloud.chronicle.v1.ComputeFindingsRefinementActivityRequest\x1a\x44.google.cloud.chronicle.v1.ComputeFindingsRefinementActivityResponse\"w\xda\x41\x04name\x82\xd3\xe4\x93\x02j\"e/v1/{name=projects/*/locations/*/instances/*/findingsRefinements/*}:computeFindingsRefinementActivity:\x01*\x12\xad\x02\n&ComputeAllFindingsRefinementActivities\x12H.google.cloud.chronicle.v1.ComputeAllFindingsRefinementActivitiesRequest\x1aI.google.cloud.chronicle.v1.ComputeAllFindingsRefinementActivitiesResponse\"n\xda\x41\x08instance\x82\xd3\xe4\x93\x02]\"X/v1/{instance=projects/*/locations/*/instances/*}:computeAllFindingsRefinementActivities:\x01*\x1a\xaa\x01\xca\x41\x18\x63hronicle.googleapis.com\xd2\x41\x8b\x01https://www.googleapis.com/auth/chronicle,https://www.googleapis.com/auth/chronicle.readonly,https://www.googleapis.com/auth/cloud-platformB\xf8\x02\n\x1d\x63om.google.cloud.chronicle.v1B\x17\x46indingsRefinementProtoP\x01Z;cloud.google.com/go/chronicle/apiv1/chroniclepb;chroniclepb\xaa\x02\x19Google.Cloud.Chronicle.V1\xca\x02\x19Google\\Cloud\\Chronicle\\V1\xea\x02\x1cGoogle::Cloud::Chronicle::V1\xea\x41\xa6\x01\n\'chronicle.googleapis.com/CuratedRuleSet\x12{projects/{project}/locations/{location}/instances/{instance}/curatedRuleSetCategories/{category}/curatedRuleSets/{rule_set}b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Chronicle + module V1 + FindingsRefinement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.FindingsRefinement").msgclass + FindingsRefinementDeployment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.FindingsRefinementDeployment").msgclass + DetectionExclusionApplication = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.DetectionExclusionApplication").msgclass + FindingsRefinementActivity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.FindingsRefinementActivity").msgclass + DetectionExclusionActivity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.DetectionExclusionActivity").msgclass + DetectionExclusionActivity::DetectionExclusionDetectorActivity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.DetectionExclusionActivity.DetectionExclusionDetectorActivity").msgclass + GetFindingsRefinementRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.GetFindingsRefinementRequest").msgclass + ListFindingsRefinementsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ListFindingsRefinementsRequest").msgclass + ListFindingsRefinementsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ListFindingsRefinementsResponse").msgclass + CreateFindingsRefinementRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.CreateFindingsRefinementRequest").msgclass + UpdateFindingsRefinementRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.UpdateFindingsRefinementRequest").msgclass + GetFindingsRefinementDeploymentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.GetFindingsRefinementDeploymentRequest").msgclass + UpdateFindingsRefinementDeploymentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.UpdateFindingsRefinementDeploymentRequest").msgclass + ListAllFindingsRefinementDeploymentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ListAllFindingsRefinementDeploymentsRequest").msgclass + ListAllFindingsRefinementDeploymentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ListAllFindingsRefinementDeploymentsResponse").msgclass + OutcomeFilter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.OutcomeFilter").msgclass + OutcomeFilter::Operator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.OutcomeFilter.Operator").enummodule + ComputeFindingsRefinementActivityRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ComputeFindingsRefinementActivityRequest").msgclass + ComputeFindingsRefinementActivityResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ComputeFindingsRefinementActivityResponse").msgclass + ComputeAllFindingsRefinementActivitiesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ComputeAllFindingsRefinementActivitiesRequest").msgclass + ComputeAllFindingsRefinementActivitiesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.ComputeAllFindingsRefinementActivitiesResponse").msgclass + FindingsRefinementType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.chronicle.v1.FindingsRefinementType").enummodule + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service.rb new file mode 100644 index 000000000000..e7c950af76d6 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/chronicle/v1/version" + +require "google/cloud/chronicle/v1/findings_refinement_service/credentials" +require "google/cloud/chronicle/v1/findings_refinement_service/paths" +require "google/cloud/chronicle/v1/findings_refinement_service/client" +require "google/cloud/chronicle/v1/findings_refinement_service/rest" + +module Google + module Cloud + module Chronicle + module V1 + ## + # FindingsRefinementService provides an interface for filtering out + # findings that are unlikely to be real threats to prevent them + # from triggering alerts or notifications. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/chronicle/v1/findings_refinement_service" + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/chronicle/v1/findings_refinement_service/rest" + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + module FindingsRefinementService + end + end + end + end +end + +helper_path = ::File.join __dir__, "findings_refinement_service", "helpers.rb" +require "google/cloud/chronicle/v1/findings_refinement_service/helpers" if ::File.file? helper_path diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/client.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/client.rb new file mode 100644 index 000000000000..98d2850b9a57 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/client.rb @@ -0,0 +1,1331 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/chronicle/v1/findings_refinement_pb" + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + ## + # Client for the FindingsRefinementService service. + # + # FindingsRefinementService provides an interface for filtering out + # findings that are unlikely to be real threats to prevent them + # from triggering alerts or notifications. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "chronicle.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :findings_refinement_service_stub + + ## + # Configure the FindingsRefinementService Client class. + # + # See {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all FindingsRefinementService clients + # ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Chronicle", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.get_findings_refinement.timeout = 60.0 + default_config.rpcs.get_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_findings_refinements.timeout = 60.0 + default_config.rpcs.list_findings_refinements.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_findings_refinement.timeout = 60.0 + default_config.rpcs.create_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_findings_refinement.timeout = 60.0 + default_config.rpcs.update_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_findings_refinement_deployment.timeout = 120.0 + default_config.rpcs.get_findings_refinement_deployment.retry_policy = { + initial_delay: 1.0, max_delay: 120.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_findings_refinement_deployment.timeout = 120.0 + + default_config.rpcs.list_all_findings_refinement_deployments.timeout = 120.0 + default_config.rpcs.list_all_findings_refinement_deployments.retry_policy = { + initial_delay: 1.0, max_delay: 120.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.compute_findings_refinement_activity.timeout = 600.0 + default_config.rpcs.compute_findings_refinement_activity.retry_policy = { + initial_delay: 1.0, max_delay: 600.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.compute_all_findings_refinement_activities.timeout = 600.0 + default_config.rpcs.compute_all_findings_refinement_activities.retry_policy = { + initial_delay: 1.0, max_delay: 600.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the FindingsRefinementService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @findings_refinement_service_stub.universe_domain + end + + ## + # Create a new FindingsRefinementService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the FindingsRefinementService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/chronicle/v1/findings_refinement_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @findings_refinement_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @findings_refinement_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @findings_refinement_service_stub.logger + end + + # Service calls + + ## + # Gets a single findings refinement. + # + # @overload get_findings_refinement(request, options = nil) + # Pass arguments to `get_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_findings_refinement(name: nil) + # Pass arguments to `get_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new + # + # # Call the get_findings_refinement method. + # result = client.get_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def get_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_findings_refinement.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :get_findings_refinement, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a collection of findings refinements. + # + # @overload list_findings_refinements(request, options = nil) + # Pass arguments to `list_findings_refinements` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_findings_refinements(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_findings_refinements` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent, which owns this collection of findings refinements. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param page_size [::Integer] + # The maximum number of findings refinements to return. The service may + # return fewer than this value. If unspecified, at most 100 rules will be + # returned. The maximum value is 1000; values above 1000 will be coerced to + # 1000. + # @param page_token [::String] + # A page token, received from a previous `ListFindingsRefinements` call. + # Provide this to retrieve the subsequent page. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinement>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinement>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new + # + # # Call the list_findings_refinements method. + # result = client.list_findings_refinements request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinement. + # p item + # end + # + def list_findings_refinements request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_findings_refinements.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_findings_refinements.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_findings_refinements.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :list_findings_refinements, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @findings_refinement_service_stub, :list_findings_refinements, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new findings refinement. + # + # @overload create_findings_refinement(request, options = nil) + # Pass arguments to `create_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_findings_refinement(parent: nil, findings_refinement: nil) + # Pass arguments to `create_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where this findings refinement will be + # created. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param findings_refinement [::Google::Cloud::Chronicle::V1::FindingsRefinement, ::Hash] + # Required. The findings refinement to create. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new + # + # # Call the create_findings_refinement method. + # result = client.create_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def create_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_findings_refinement.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :create_findings_refinement, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a findings refinement. + # + # @overload update_findings_refinement(request, options = nil) + # Pass arguments to `update_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_findings_refinement(findings_refinement: nil, update_mask: nil) + # Pass arguments to `update_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param findings_refinement [::Google::Cloud::Chronicle::V1::FindingsRefinement, ::Hash] + # Required. The findings refinement to update. + # + # The findings refinement's `name` field is used to identify the findings + # refinement to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. The list of fields to update. If `*` is provided, all fields will + # be updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new + # + # # Call the update_findings_refinement method. + # result = client.update_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def update_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.findings_refinement&.name + header_params["findings_refinement.name"] = request.findings_refinement.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_findings_refinement.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :update_findings_refinement, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a findings refinement deployment. + # + # @overload get_findings_refinement_deployment(request, options = nil) + # Pass arguments to `get_findings_refinement_deployment` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_findings_refinement_deployment(name: nil) + # Pass arguments to `get_findings_refinement_deployment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new + # + # # Call the get_findings_refinement_deployment method. + # result = client.get_findings_refinement_deployment request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p result + # + def get_findings_refinement_deployment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_findings_refinement_deployment.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_findings_refinement_deployment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_findings_refinement_deployment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :get_findings_refinement_deployment, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a findings refinement deployment. + # + # @overload update_findings_refinement_deployment(request, options = nil) + # Pass arguments to `update_findings_refinement_deployment` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_findings_refinement_deployment(findings_refinement_deployment: nil, update_mask: nil) + # Pass arguments to `update_findings_refinement_deployment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param findings_refinement_deployment [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment, ::Hash] + # Required. The findings refinement deployment to update. + # + # The findings refinement deployment's `name` field is used to identify the + # findings refinement deployment to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. The list of fields to update. If `*` is provided, all fields will + # be updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new + # + # # Call the update_findings_refinement_deployment method. + # result = client.update_findings_refinement_deployment request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p result + # + def update_findings_refinement_deployment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_findings_refinement_deployment.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.findings_refinement_deployment&.name + header_params["findings_refinement_deployment.name"] = request.findings_refinement_deployment.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_findings_refinement_deployment.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_findings_refinement_deployment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :update_findings_refinement_deployment, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all findings refinement deployments. + # + # @overload list_all_findings_refinement_deployments(request, options = nil) + # Pass arguments to `list_all_findings_refinement_deployments` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_all_findings_refinement_deployments(instance: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_all_findings_refinement_deployments` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The name of the parent resource, which is the SecOps instance to + # list all findings refinement deployments over. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param page_size [::Integer] + # The maximum number of findings refinement deployments to return. The + # service may return fewer than this value. If unspecified, at most 100 rule + # deployments will be returned. The maximum value is 1000; values above 1000 + # will be coerced to 1000. + # @param page_token [::String] + # A page token, received from a previous + # `ListAllFindingsRefinementDeployments` call. Provide this to retrieve the + # subsequent page. + # + # When paginating, all other parameters provided to + # `ListAllFindingsRefinementDeployments` must match the call that provided + # the page token. + # @param filter [::String] + # A filter that can be used to retrieve specific findings refinement + # deployments. + # Only the following filters are allowed: + # detection_exclusion_application.curated_rule_sets:""", + # detection_exclusion_application.curated_rules:"" + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new + # + # # Call the list_all_findings_refinement_deployments method. + # result = client.list_all_findings_refinement_deployments request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p item + # end + # + def list_all_findings_refinement_deployments request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_all_findings_refinement_deployments.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_all_findings_refinement_deployments.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_all_findings_refinement_deployments.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :list_all_findings_refinement_deployments, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @findings_refinement_service_stub, :list_all_findings_refinement_deployments, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns findings refinement activity for a specific findings refinement. + # + # @overload compute_findings_refinement_activity(request, options = nil) + # Pass arguments to `compute_findings_refinement_activity` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload compute_findings_refinement_activity(name: nil, interval: nil) + # Pass arguments to `compute_findings_refinement_activity` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name for the findings refinement to fetch the + # activity for. Format: + # projects/\\{project}/locations/\\{region}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @param interval [::Google::Type::Interval, ::Hash] + # The time interval the activity is measured over. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new + # + # # Call the compute_findings_refinement_activity method. + # result = client.compute_findings_refinement_activity request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse. + # p result + # + def compute_findings_refinement_activity request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.compute_findings_refinement_activity.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.compute_findings_refinement_activity.timeout, + metadata: metadata, + retry_policy: @config.rpcs.compute_findings_refinement_activity.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :compute_findings_refinement_activity, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns findings refinement activity for all findings refinements. + # + # @overload compute_all_findings_refinement_activities(request, options = nil) + # Pass arguments to `compute_all_findings_refinement_activities` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload compute_all_findings_refinement_activities(instance: nil, interval: nil) + # Pass arguments to `compute_all_findings_refinement_activities` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The ID of the Instance to retrieve counts for. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param interval [::Google::Type::Interval, ::Hash] + # The time interval the activity is measured over. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new + # + # # Call the compute_all_findings_refinement_activities method. + # result = client.compute_all_findings_refinement_activities request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse. + # p result + # + def compute_all_findings_refinement_activities request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.compute_all_findings_refinement_activities.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.instance + header_params["instance"] = request.instance + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.compute_all_findings_refinement_activities.timeout, + metadata: metadata, + retry_policy: @config.rpcs.compute_all_findings_refinement_activities.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.call_rpc :compute_all_findings_refinement_activities, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the FindingsRefinementService API. + # + # This class represents the configuration for FindingsRefinementService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_findings_refinement to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_findings_refinement.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_findings_refinement.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "chronicle.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the FindingsRefinementService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :get_findings_refinement + ## + # RPC-specific configuration for `list_findings_refinements` + # @return [::Gapic::Config::Method] + # + attr_reader :list_findings_refinements + ## + # RPC-specific configuration for `create_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :create_findings_refinement + ## + # RPC-specific configuration for `update_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :update_findings_refinement + ## + # RPC-specific configuration for `get_findings_refinement_deployment` + # @return [::Gapic::Config::Method] + # + attr_reader :get_findings_refinement_deployment + ## + # RPC-specific configuration for `update_findings_refinement_deployment` + # @return [::Gapic::Config::Method] + # + attr_reader :update_findings_refinement_deployment + ## + # RPC-specific configuration for `list_all_findings_refinement_deployments` + # @return [::Gapic::Config::Method] + # + attr_reader :list_all_findings_refinement_deployments + ## + # RPC-specific configuration for `compute_findings_refinement_activity` + # @return [::Gapic::Config::Method] + # + attr_reader :compute_findings_refinement_activity + ## + # RPC-specific configuration for `compute_all_findings_refinement_activities` + # @return [::Gapic::Config::Method] + # + attr_reader :compute_all_findings_refinement_activities + + # @private + def initialize parent_rpcs = nil + get_findings_refinement_config = parent_rpcs.get_findings_refinement if parent_rpcs.respond_to? :get_findings_refinement + @get_findings_refinement = ::Gapic::Config::Method.new get_findings_refinement_config + list_findings_refinements_config = parent_rpcs.list_findings_refinements if parent_rpcs.respond_to? :list_findings_refinements + @list_findings_refinements = ::Gapic::Config::Method.new list_findings_refinements_config + create_findings_refinement_config = parent_rpcs.create_findings_refinement if parent_rpcs.respond_to? :create_findings_refinement + @create_findings_refinement = ::Gapic::Config::Method.new create_findings_refinement_config + update_findings_refinement_config = parent_rpcs.update_findings_refinement if parent_rpcs.respond_to? :update_findings_refinement + @update_findings_refinement = ::Gapic::Config::Method.new update_findings_refinement_config + get_findings_refinement_deployment_config = parent_rpcs.get_findings_refinement_deployment if parent_rpcs.respond_to? :get_findings_refinement_deployment + @get_findings_refinement_deployment = ::Gapic::Config::Method.new get_findings_refinement_deployment_config + update_findings_refinement_deployment_config = parent_rpcs.update_findings_refinement_deployment if parent_rpcs.respond_to? :update_findings_refinement_deployment + @update_findings_refinement_deployment = ::Gapic::Config::Method.new update_findings_refinement_deployment_config + list_all_findings_refinement_deployments_config = parent_rpcs.list_all_findings_refinement_deployments if parent_rpcs.respond_to? :list_all_findings_refinement_deployments + @list_all_findings_refinement_deployments = ::Gapic::Config::Method.new list_all_findings_refinement_deployments_config + compute_findings_refinement_activity_config = parent_rpcs.compute_findings_refinement_activity if parent_rpcs.respond_to? :compute_findings_refinement_activity + @compute_findings_refinement_activity = ::Gapic::Config::Method.new compute_findings_refinement_activity_config + compute_all_findings_refinement_activities_config = parent_rpcs.compute_all_findings_refinement_activities if parent_rpcs.respond_to? :compute_all_findings_refinement_activities + @compute_all_findings_refinement_activities = ::Gapic::Config::Method.new compute_all_findings_refinement_activities_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/credentials.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/credentials.rb new file mode 100644 index 000000000000..96caf5413bb1 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/credentials.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + # Credentials for the FindingsRefinementService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/chronicle", + "https://www.googleapis.com/auth/chronicle.readonly", + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/paths.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/paths.rb new file mode 100644 index 000000000000..247829e15e90 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/paths.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + # Path helper methods for the FindingsRefinementService API. + module Paths + ## + # Create a fully-qualified CuratedRule resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}/curatedRules/{curated_rule}` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # @param curated_rule [String] + # + # @return [::String] + def curated_rule_path project:, location:, instance:, curated_rule: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}/curatedRules/#{curated_rule}" + end + + ## + # Create a fully-qualified CuratedRuleSet resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}/curatedRuleSetCategories/{category}/curatedRuleSets/{rule_set}` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # @param category [String] + # @param rule_set [String] + # + # @return [::String] + def curated_rule_set_path project:, location:, instance:, category:, rule_set: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" + raise ::ArgumentError, "category cannot contain /" if category.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}/curatedRuleSetCategories/#{category}/curatedRuleSets/#{rule_set}" + end + + ## + # Create a fully-qualified FindingsRefinement resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}/findingsRefinements/{findings_refinement}` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # @param findings_refinement [String] + # + # @return [::String] + def findings_refinement_path project:, location:, instance:, findings_refinement: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}/findingsRefinements/#{findings_refinement}" + end + + ## + # Create a fully-qualified FindingsRefinementDeployment resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}/findingsRefinements/{findings_refinement}/deployment` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # @param findings_refinement [String] + # + # @return [::String] + def findings_refinement_deployment_path project:, location:, instance:, findings_refinement: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}/findingsRefinements/#{findings_refinement}/deployment" + end + + ## + # Create a fully-qualified Instance resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # + # @return [::String] + def instance_path project:, location:, instance: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}" + end + + ## + # Create a fully-qualified Rule resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}` + # + # @param project [String] + # @param location [String] + # @param instance [String] + # @param rule [String] + # + # @return [::String] + def rule_path project:, location:, instance:, rule: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" + + "projects/#{project}/locations/#{location}/instances/#{instance}/rules/#{rule}" + end + + extend self + end + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest.rb new file mode 100644 index 000000000000..552a3421a9e7 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/chronicle/v1/version" + +require "google/cloud/chronicle/v1/findings_refinement_service/credentials" +require "google/cloud/chronicle/v1/findings_refinement_service/paths" +require "google/cloud/chronicle/v1/findings_refinement_service/rest/client" + +module Google + module Cloud + module Chronicle + module V1 + ## + # FindingsRefinementService provides an interface for filtering out + # findings that are unlikely to be real threats to prevent them + # from triggering alerts or notifications. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/chronicle/v1/findings_refinement_service/rest" + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + module FindingsRefinementService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/chronicle/v1/findings_refinement_service/rest/helpers" if ::File.file? helper_path diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/client.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/client.rb new file mode 100644 index 000000000000..16d1b336f6ec --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/client.rb @@ -0,0 +1,1225 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/chronicle/v1/findings_refinement_pb" +require "google/cloud/chronicle/v1/findings_refinement_service/rest/service_stub" + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + module Rest + ## + # REST client for the FindingsRefinementService service. + # + # FindingsRefinementService provides an interface for filtering out + # findings that are unlikely to be real threats to prevent them + # from triggering alerts or notifications. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "chronicle.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :findings_refinement_service_stub + + ## + # Configure the FindingsRefinementService Client class. + # + # See {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all FindingsRefinementService clients + # ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Chronicle", "V1"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.get_findings_refinement.timeout = 60.0 + default_config.rpcs.get_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.list_findings_refinements.timeout = 60.0 + default_config.rpcs.list_findings_refinements.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.create_findings_refinement.timeout = 60.0 + default_config.rpcs.create_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_findings_refinement.timeout = 60.0 + default_config.rpcs.update_findings_refinement.retry_policy = { + initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.get_findings_refinement_deployment.timeout = 120.0 + default_config.rpcs.get_findings_refinement_deployment.retry_policy = { + initial_delay: 1.0, max_delay: 120.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.update_findings_refinement_deployment.timeout = 120.0 + + default_config.rpcs.list_all_findings_refinement_deployments.timeout = 120.0 + default_config.rpcs.list_all_findings_refinement_deployments.retry_policy = { + initial_delay: 1.0, max_delay: 120.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.compute_findings_refinement_activity.timeout = 600.0 + default_config.rpcs.compute_findings_refinement_activity.retry_policy = { + initial_delay: 1.0, max_delay: 600.0, multiplier: 1.3, retry_codes: [14] + } + + default_config.rpcs.compute_all_findings_refinement_activities.timeout = 600.0 + default_config.rpcs.compute_all_findings_refinement_activities.retry_policy = { + initial_delay: 1.0, max_delay: 600.0, multiplier: 1.3, retry_codes: [14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the FindingsRefinementService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @findings_refinement_service_stub.universe_domain + end + + ## + # Create a new FindingsRefinementService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the FindingsRefinementService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @findings_refinement_service_stub = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @findings_refinement_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @findings_refinement_service_stub.logger + end + + # Service calls + + ## + # Gets a single findings refinement. + # + # @overload get_findings_refinement(request, options = nil) + # Pass arguments to `get_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_findings_refinement(name: nil) + # Pass arguments to `get_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new + # + # # Call the get_findings_refinement method. + # result = client.get_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def get_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_findings_refinement.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.get_findings_refinement request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists a collection of findings refinements. + # + # @overload list_findings_refinements(request, options = nil) + # Pass arguments to `list_findings_refinements` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_findings_refinements(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_findings_refinements` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent, which owns this collection of findings refinements. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param page_size [::Integer] + # The maximum number of findings refinements to return. The service may + # return fewer than this value. If unspecified, at most 100 rules will be + # returned. The maximum value is 1000; values above 1000 will be coerced to + # 1000. + # @param page_token [::String] + # A page token, received from a previous `ListFindingsRefinements` call. + # Provide this to retrieve the subsequent page. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinement>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinement>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new + # + # # Call the list_findings_refinements method. + # result = client.list_findings_refinements request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinement. + # p item + # end + # + def list_findings_refinements request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_findings_refinements.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_findings_refinements.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_findings_refinements.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.list_findings_refinements request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @findings_refinement_service_stub, :list_findings_refinements, "findings_refinements", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a new findings refinement. + # + # @overload create_findings_refinement(request, options = nil) + # Pass arguments to `create_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_findings_refinement(parent: nil, findings_refinement: nil) + # Pass arguments to `create_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource where this findings refinement will be + # created. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param findings_refinement [::Google::Cloud::Chronicle::V1::FindingsRefinement, ::Hash] + # Required. The findings refinement to create. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new + # + # # Call the create_findings_refinement method. + # result = client.create_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def create_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_findings_refinement.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.create_findings_refinement request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a findings refinement. + # + # @overload update_findings_refinement(request, options = nil) + # Pass arguments to `update_findings_refinement` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_findings_refinement(findings_refinement: nil, update_mask: nil) + # Pass arguments to `update_findings_refinement` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param findings_refinement [::Google::Cloud::Chronicle::V1::FindingsRefinement, ::Hash] + # Required. The findings refinement to update. + # + # The findings refinement's `name` field is used to identify the findings + # refinement to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. The list of fields to update. If `*` is provided, all fields will + # be updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new + # + # # Call the update_findings_refinement method. + # result = client.update_findings_refinement request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + # p result + # + def update_findings_refinement request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_findings_refinement.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_findings_refinement.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_findings_refinement.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.update_findings_refinement request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a findings refinement deployment. + # + # @overload get_findings_refinement_deployment(request, options = nil) + # Pass arguments to `get_findings_refinement_deployment` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_findings_refinement_deployment(name: nil) + # Pass arguments to `get_findings_refinement_deployment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new + # + # # Call the get_findings_refinement_deployment method. + # result = client.get_findings_refinement_deployment request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p result + # + def get_findings_refinement_deployment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_findings_refinement_deployment.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_findings_refinement_deployment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_findings_refinement_deployment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.get_findings_refinement_deployment request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a findings refinement deployment. + # + # @overload update_findings_refinement_deployment(request, options = nil) + # Pass arguments to `update_findings_refinement_deployment` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_findings_refinement_deployment(findings_refinement_deployment: nil, update_mask: nil) + # Pass arguments to `update_findings_refinement_deployment` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param findings_refinement_deployment [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment, ::Hash] + # Required. The findings refinement deployment to update. + # + # The findings refinement deployment's `name` field is used to identify the + # findings refinement deployment to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Required. The list of fields to update. If `*` is provided, all fields will + # be updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new + # + # # Call the update_findings_refinement_deployment method. + # result = client.update_findings_refinement_deployment request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p result + # + def update_findings_refinement_deployment request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_findings_refinement_deployment.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_findings_refinement_deployment.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_findings_refinement_deployment.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.update_findings_refinement_deployment request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all findings refinement deployments. + # + # @overload list_all_findings_refinement_deployments(request, options = nil) + # Pass arguments to `list_all_findings_refinement_deployments` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_all_findings_refinement_deployments(instance: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_all_findings_refinement_deployments` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The name of the parent resource, which is the SecOps instance to + # list all findings refinement deployments over. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param page_size [::Integer] + # The maximum number of findings refinement deployments to return. The + # service may return fewer than this value. If unspecified, at most 100 rule + # deployments will be returned. The maximum value is 1000; values above 1000 + # will be coerced to 1000. + # @param page_token [::String] + # A page token, received from a previous + # `ListAllFindingsRefinementDeployments` call. Provide this to retrieve the + # subsequent page. + # + # When paginating, all other parameters provided to + # `ListAllFindingsRefinementDeployments` must match the call that provided + # the page token. + # @param filter [::String] + # A filter that can be used to retrieve specific findings refinement + # deployments. + # Only the following filters are allowed: + # detection_exclusion_application.curated_rule_sets:""", + # detection_exclusion_application.curated_rules:"" + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new + # + # # Call the list_all_findings_refinement_deployments method. + # result = client.list_all_findings_refinement_deployments request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + # p item + # end + # + def list_all_findings_refinement_deployments request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_all_findings_refinement_deployments.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_all_findings_refinement_deployments.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_all_findings_refinement_deployments.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.list_all_findings_refinement_deployments request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @findings_refinement_service_stub, :list_all_findings_refinement_deployments, "all_findings_refinement_deployments", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns findings refinement activity for a specific findings refinement. + # + # @overload compute_findings_refinement_activity(request, options = nil) + # Pass arguments to `compute_findings_refinement_activity` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload compute_findings_refinement_activity(name: nil, interval: nil) + # Pass arguments to `compute_findings_refinement_activity` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name for the findings refinement to fetch the + # activity for. Format: + # projects/\\{project}/locations/\\{region}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @param interval [::Google::Type::Interval, ::Hash] + # The time interval the activity is measured over. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new + # + # # Call the compute_findings_refinement_activity method. + # result = client.compute_findings_refinement_activity request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse. + # p result + # + def compute_findings_refinement_activity request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.compute_findings_refinement_activity.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.compute_findings_refinement_activity.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.compute_findings_refinement_activity.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.compute_findings_refinement_activity request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns findings refinement activity for all findings refinements. + # + # @overload compute_all_findings_refinement_activities(request, options = nil) + # Pass arguments to `compute_all_findings_refinement_activities` via a request object, either of type + # {::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload compute_all_findings_refinement_activities(instance: nil, interval: nil) + # Pass arguments to `compute_all_findings_refinement_activities` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param instance [::String] + # Required. The ID of the Instance to retrieve counts for. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @param interval [::Google::Type::Interval, ::Hash] + # The time interval the activity is measured over. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/chronicle/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new + # + # # Call the compute_all_findings_refinement_activities method. + # result = client.compute_all_findings_refinement_activities request + # + # # The returned object is of type Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse. + # p result + # + def compute_all_findings_refinement_activities request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.compute_all_findings_refinement_activities.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Chronicle::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.compute_all_findings_refinement_activities.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.compute_all_findings_refinement_activities.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @findings_refinement_service_stub.compute_all_findings_refinement_activities request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the FindingsRefinementService REST API. + # + # This class represents the configuration for FindingsRefinementService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # get_findings_refinement to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.get_findings_refinement.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.get_findings_refinement.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "chronicle.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the FindingsRefinementService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `get_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :get_findings_refinement + ## + # RPC-specific configuration for `list_findings_refinements` + # @return [::Gapic::Config::Method] + # + attr_reader :list_findings_refinements + ## + # RPC-specific configuration for `create_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :create_findings_refinement + ## + # RPC-specific configuration for `update_findings_refinement` + # @return [::Gapic::Config::Method] + # + attr_reader :update_findings_refinement + ## + # RPC-specific configuration for `get_findings_refinement_deployment` + # @return [::Gapic::Config::Method] + # + attr_reader :get_findings_refinement_deployment + ## + # RPC-specific configuration for `update_findings_refinement_deployment` + # @return [::Gapic::Config::Method] + # + attr_reader :update_findings_refinement_deployment + ## + # RPC-specific configuration for `list_all_findings_refinement_deployments` + # @return [::Gapic::Config::Method] + # + attr_reader :list_all_findings_refinement_deployments + ## + # RPC-specific configuration for `compute_findings_refinement_activity` + # @return [::Gapic::Config::Method] + # + attr_reader :compute_findings_refinement_activity + ## + # RPC-specific configuration for `compute_all_findings_refinement_activities` + # @return [::Gapic::Config::Method] + # + attr_reader :compute_all_findings_refinement_activities + + # @private + def initialize parent_rpcs = nil + get_findings_refinement_config = parent_rpcs.get_findings_refinement if parent_rpcs.respond_to? :get_findings_refinement + @get_findings_refinement = ::Gapic::Config::Method.new get_findings_refinement_config + list_findings_refinements_config = parent_rpcs.list_findings_refinements if parent_rpcs.respond_to? :list_findings_refinements + @list_findings_refinements = ::Gapic::Config::Method.new list_findings_refinements_config + create_findings_refinement_config = parent_rpcs.create_findings_refinement if parent_rpcs.respond_to? :create_findings_refinement + @create_findings_refinement = ::Gapic::Config::Method.new create_findings_refinement_config + update_findings_refinement_config = parent_rpcs.update_findings_refinement if parent_rpcs.respond_to? :update_findings_refinement + @update_findings_refinement = ::Gapic::Config::Method.new update_findings_refinement_config + get_findings_refinement_deployment_config = parent_rpcs.get_findings_refinement_deployment if parent_rpcs.respond_to? :get_findings_refinement_deployment + @get_findings_refinement_deployment = ::Gapic::Config::Method.new get_findings_refinement_deployment_config + update_findings_refinement_deployment_config = parent_rpcs.update_findings_refinement_deployment if parent_rpcs.respond_to? :update_findings_refinement_deployment + @update_findings_refinement_deployment = ::Gapic::Config::Method.new update_findings_refinement_deployment_config + list_all_findings_refinement_deployments_config = parent_rpcs.list_all_findings_refinement_deployments if parent_rpcs.respond_to? :list_all_findings_refinement_deployments + @list_all_findings_refinement_deployments = ::Gapic::Config::Method.new list_all_findings_refinement_deployments_config + compute_findings_refinement_activity_config = parent_rpcs.compute_findings_refinement_activity if parent_rpcs.respond_to? :compute_findings_refinement_activity + @compute_findings_refinement_activity = ::Gapic::Config::Method.new compute_findings_refinement_activity_config + compute_all_findings_refinement_activities_config = parent_rpcs.compute_all_findings_refinement_activities if parent_rpcs.respond_to? :compute_all_findings_refinement_activities + @compute_all_findings_refinement_activities = ::Gapic::Config::Method.new compute_all_findings_refinement_activities_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/service_stub.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/service_stub.rb new file mode 100644 index 000000000000..83d86deb0e3e --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_service/rest/service_stub.rb @@ -0,0 +1,635 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/chronicle/v1/findings_refinement_pb" + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + module Rest + ## + # REST service stub for the FindingsRefinementService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the get_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # A result object deserialized from the server's reply + def get_findings_refinement request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_findings_refinement_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_findings_refinement", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_findings_refinements REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse] + # A result object deserialized from the server's reply + def list_findings_refinements request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_findings_refinements_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_findings_refinements", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # A result object deserialized from the server's reply + def create_findings_refinement request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_findings_refinement_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_findings_refinement", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # A result object deserialized from the server's reply + def update_findings_refinement request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_findings_refinement_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_findings_refinement", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_findings_refinement_deployment REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # A result object deserialized from the server's reply + def get_findings_refinement_deployment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_findings_refinement_deployment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_findings_refinement_deployment", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_findings_refinement_deployment REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # A result object deserialized from the server's reply + def update_findings_refinement_deployment request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_findings_refinement_deployment_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_findings_refinement_deployment", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_all_findings_refinement_deployments REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse] + # A result object deserialized from the server's reply + def list_all_findings_refinement_deployments request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_all_findings_refinement_deployments_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_all_findings_refinement_deployments", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the compute_findings_refinement_activity REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse] + # A result object deserialized from the server's reply + def compute_findings_refinement_activity request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_compute_findings_refinement_activity_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "compute_findings_refinement_activity", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the compute_all_findings_refinement_activities REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse] + # A result object deserialized from the server's reply + def compute_all_findings_refinement_activities request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_compute_all_findings_refinement_activities_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "compute_all_findings_refinement_activities", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the get_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_findings_refinement_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/findingsRefinements/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_findings_refinements REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_findings_refinements_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/findingsRefinements", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_findings_refinement_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{parent}/findingsRefinements", + body: "findings_refinement", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_findings_refinement REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_findings_refinement_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{findings_refinement.name}", + body: "findings_refinement", + matches: [ + ["findings_refinement.name", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/findingsRefinements/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_findings_refinement_deployment REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_findings_refinement_deployment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/findingsRefinements/[^/]+/deployment/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_findings_refinement_deployment REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_findings_refinement_deployment_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v1/{findings_refinement_deployment.name}", + body: "findings_refinement_deployment", + matches: [ + ["findings_refinement_deployment.name", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/findingsRefinements/[^/]+/deployment/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_all_findings_refinement_deployments REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_all_findings_refinement_deployments_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{instance}:listAllFindingsRefinementDeployments", + matches: [ + ["instance", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the compute_findings_refinement_activity REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_compute_findings_refinement_activity_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:computeFindingsRefinementActivity", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/findingsRefinements/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the compute_all_findings_refinement_activities REST call + # + # @param request_pb [::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_compute_all_findings_refinement_activities_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{instance}:computeAllFindingsRefinementActivities", + body: "*", + matches: [ + ["instance", %r{^projects/[^/]+/locations/[^/]+/instances/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_services_pb.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_services_pb.rb new file mode 100644 index 000000000000..1e62000d5276 --- /dev/null +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/findings_refinement_services_pb.rb @@ -0,0 +1,63 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/chronicle/v1/findings_refinement.proto for package 'Google.Cloud.Chronicle.V1' +# Original file comments: +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/chronicle/v1/findings_refinement_pb' + +module Google + module Cloud + module Chronicle + module V1 + module FindingsRefinementService + # FindingsRefinementService provides an interface for filtering out + # findings that are unlikely to be real threats to prevent them + # from triggering alerts or notifications. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.chronicle.v1.FindingsRefinementService' + + # Gets a single findings refinement. + rpc :GetFindingsRefinement, ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest, ::Google::Cloud::Chronicle::V1::FindingsRefinement + # Lists a collection of findings refinements. + rpc :ListFindingsRefinements, ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest, ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse + # Creates a new findings refinement. + rpc :CreateFindingsRefinement, ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest, ::Google::Cloud::Chronicle::V1::FindingsRefinement + # Updates a findings refinement. + rpc :UpdateFindingsRefinement, ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest, ::Google::Cloud::Chronicle::V1::FindingsRefinement + # Gets a findings refinement deployment. + rpc :GetFindingsRefinementDeployment, ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest, ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment + # Updates a findings refinement deployment. + rpc :UpdateFindingsRefinementDeployment, ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest, ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment + # Lists all findings refinement deployments. + rpc :ListAllFindingsRefinementDeployments, ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest, ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse + # Returns findings refinement activity for a specific findings refinement. + rpc :ComputeFindingsRefinementActivity, ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest, ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse + # Returns findings refinement activity for all findings refinements. + rpc :ComputeAllFindingsRefinementActivities, ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest, ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/rest.rb b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/rest.rb index 189b75b50f50..512b688df6f1 100644 --- a/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/rest.rb +++ b/google-cloud-chronicle-v1/lib/google/cloud/chronicle/v1/rest.rb @@ -24,6 +24,7 @@ require "google/cloud/chronicle/v1/entity_service/rest" require "google/cloud/chronicle/v1/native_dashboard_service/rest" require "google/cloud/chronicle/v1/featured_content_native_dashboard_service/rest" +require "google/cloud/chronicle/v1/findings_refinement_service/rest" require "google/cloud/chronicle/v1/instance_service/rest" require "google/cloud/chronicle/v1/reference_list_service/rest" require "google/cloud/chronicle/v1/rule_service/rest" diff --git a/google-cloud-chronicle-v1/proto_docs/google/cloud/chronicle/v1/findings_refinement.rb b/google-cloud-chronicle-v1/proto_docs/google/cloud/chronicle/v1/findings_refinement.rb new file mode 100644 index 000000000000..ae5bfe5129a4 --- /dev/null +++ b/google-cloud-chronicle-v1/proto_docs/google/cloud/chronicle/v1/findings_refinement.rb @@ -0,0 +1,439 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Chronicle + module V1 + # Represents a set of logic conditions used to refine various types of + # findings such as curated rule detections. + # @!attribute [rw] name + # @return [::String] + # Full resource name for the findings refinement. + # Format: + # projects/\\{project}/locations/\\{region}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @!attribute [rw] display_name + # @return [::String] + # Display name of the findings refinement. + # @!attribute [rw] type + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementType] + # The type of findings refinement. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The timestamp of when the findings refinement was created. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The timestamp of when the findings refinement was last + # updated. + # @!attribute [rw] query + # @return [::String] + # The query for the findings refinement. Works in conjunction with the type + # field to determine the findings refinement behavior. The syntax of this + # query is the same as a UDM search string. See the following for more + # information: + # https://cloud.google.com/chronicle/docs/investigation/udm-search + # @!attribute [rw] outcome_filters + # @return [::Array<::Google::Cloud::Chronicle::V1::OutcomeFilter>] + # Optional. The outcome filters for the findings refinement. These allow you + # to specify filters that are applied to the outcome variables in the + # detection. All filters must be true for a detection to match the findings + # refinement. + class FindingsRefinement + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The FindingsRefinementDeployment resource represents the deployment state of + # a findings refinement. + # @!attribute [rw] detection_exclusion_application + # @return [::Google::Cloud::Chronicle::V1::DetectionExclusionApplication] + # The resources which the detection exclusion is applied to. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the findings refinement deployment. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # @!attribute [rw] enabled + # @return [::Boolean] + # Whether the findings refinement is currently deployed continuously against + # incoming findings. + # @!attribute [rw] archived + # @return [::Boolean] + # The archive state of the findings refinement deployment. + # Cannot be set to true unless enabled is set to false. + # If currently set to true, enabled cannot be updated to true. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The timestamp when the findings refinement deployment was last + # updated. + class FindingsRefinementDeployment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Describes the detectors a detection exclusion is applied to. + # @!attribute [rw] curated_rule_sets + # @return [::Array<::String>] + # The CuratedRuleSets this detection exclusion applies to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRuleSetCategories/\\{category}/curatedRuleSets/\\{rule_set} + # @!attribute [rw] curated_rules + # @return [::Array<::String>] + # The CuratedRules this detection exclusion applies to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRules/\\{rule} + # @!attribute [rw] rules + # @return [::Array<::String>] + # Optional. The Rules this detection exclusion applies to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/rules/\\{rule} + # @!attribute [r] deleted_curated_rule_sets + # @return [::Array<::String>] + # Output only. The deleted CuratedRuleSets this detection exclusion applies + # to. Indicates to the customer that the detection exclusion no longer + # applies to the rule sets, so the detection exclusion should be updated. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRuleSetCategories/\\{category}/curatedRuleSets/\\{rule_set} + class DetectionExclusionApplication + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The activity for a specific findings refinement. + # @!attribute [rw] detection_exclusion_activity + # @return [::Google::Cloud::Chronicle::V1::DetectionExclusionActivity] + # The activity for the detection exclusion. + # @!attribute [rw] findings_refinement + # @return [::String] + # Required. Full resource name for the findings refinement this activity + # corresponds to. Format: + # projects/\\{project}/locations/\\{region}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + class FindingsRefinementActivity + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The activity for a findings refinement that is a detection exclusion. The + # activity is broken down per detector. + # @!attribute [rw] detection_exclusion_detector_activities + # @return [::Array<::Google::Cloud::Chronicle::V1::DetectionExclusionActivity::DetectionExclusionDetectorActivity>] + # The activity for the detection exclusion broken down by detector. + class DetectionExclusionActivity + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The activity for a findings refinement that is a detection exclusion broken + # down for one specific detector. + # @!attribute [rw] curated_rule + # @return [::String] + # Full resource name for the curated rule this activity corresponds to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRules/\\{rule} + # + # Note: The following fields are mutually exclusive: `curated_rule`, `curated_rule_set`, `rule`, `deleted_curated_rule_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] curated_rule_set + # @return [::String] + # Full resource name for the curated rule set this activity corresponds + # to. This field will only be set if the customer has access to the + # curated rule set the exclusion is applied to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRuleSetCategories/\\{curated_rule_set_category}/curatedRuleSets/\\{curated_rule_set} + # + # Note: The following fields are mutually exclusive: `curated_rule_set`, `curated_rule`, `rule`, `deleted_curated_rule_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] rule + # @return [::String] + # Full resource name for the rule this activity corresponds to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/rules/\\{rule} + # + # Note: The following fields are mutually exclusive: `rule`, `curated_rule`, `curated_rule_set`, `deleted_curated_rule_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] deleted_curated_rule_set + # @return [::String] + # Full resource name for the deleted curated rule set this activity + # corresponds to. This field will only be set if the customer does + # not have access to the curated rule set the exclusion is applied to. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/curatedRuleSetCategories/\\{curated_rule_set_category}/curatedRuleSets/\\{curated_rule_set} + # + # Note: The following fields are mutually exclusive: `deleted_curated_rule_set`, `curated_rule`, `curated_rule_set`, `rule`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] excluded_detection_count + # @return [::Integer] + # The number of detections for the detector that were excluded by the + # detection exclusion. + # @!attribute [rw] total_detection_count + # @return [::Integer] + # The total number of detections found by the detector. This includes both + # excluded detections and non-excluded detections. + class DetectionExclusionDetectorActivity + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Request message for GetFindingsRefinement method. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + class GetFindingsRefinementRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListFindingsRefinements method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent, which owns this collection of findings refinements. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @!attribute [rw] page_size + # @return [::Integer] + # The maximum number of findings refinements to return. The service may + # return fewer than this value. If unspecified, at most 100 rules will be + # returned. The maximum value is 1000; values above 1000 will be coerced to + # 1000. + # @!attribute [rw] page_token + # @return [::String] + # A page token, received from a previous `ListFindingsRefinements` call. + # Provide this to retrieve the subsequent page. + class ListFindingsRefinementsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListFindingsRefinements method. + # @!attribute [rw] findings_refinements + # @return [::Array<::Google::Cloud::Chronicle::V1::FindingsRefinement>] + # List of findings refinements. + # @!attribute [rw] next_page_token + # @return [::String] + # A token, which can be sent as `page_token` to retrieve the next page. If + # this field is omitted, there are no subsequent pages. + class ListFindingsRefinementsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for CreateFindingsRefinement method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent resource where this findings refinement will be + # created. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @!attribute [rw] findings_refinement + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # Required. The findings refinement to create. + class CreateFindingsRefinementRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for UpdateFindingsRefinement method. + # @!attribute [rw] findings_refinement + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinement] + # Required. The findings refinement to update. + # + # The findings refinement's `name` field is used to identify the findings + # refinement to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. The list of fields to update. If `*` is provided, all fields will + # be updated. + class UpdateFindingsRefinementRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for GetFindingsRefinementDeployment method. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the findings refinement to retrieve. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + class GetFindingsRefinementDeploymentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for UpdateFindingsRefinementDeployment method. + # @!attribute [rw] findings_refinement_deployment + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment] + # Required. The findings refinement deployment to update. + # + # The findings refinement deployment's `name` field is used to identify the + # findings refinement deployment to update. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance}/findingsRefinements/\\{findings_refinement}/deployment + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Required. The list of fields to update. If `*` is provided, all fields will + # be updated. + class UpdateFindingsRefinementDeploymentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListAllFindingsRefinementDeployments method. + # @!attribute [rw] instance + # @return [::String] + # Required. The name of the parent resource, which is the SecOps instance to + # list all findings refinement deployments over. Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @!attribute [rw] page_size + # @return [::Integer] + # The maximum number of findings refinement deployments to return. The + # service may return fewer than this value. If unspecified, at most 100 rule + # deployments will be returned. The maximum value is 1000; values above 1000 + # will be coerced to 1000. + # @!attribute [rw] page_token + # @return [::String] + # A page token, received from a previous + # `ListAllFindingsRefinementDeployments` call. Provide this to retrieve the + # subsequent page. + # + # When paginating, all other parameters provided to + # `ListAllFindingsRefinementDeployments` must match the call that provided + # the page token. + # @!attribute [rw] filter + # @return [::String] + # A filter that can be used to retrieve specific findings refinement + # deployments. + # Only the following filters are allowed: + # detection_exclusion_application.curated_rule_sets:""", + # detection_exclusion_application.curated_rules:"" + class ListAllFindingsRefinementDeploymentsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListAllFindingsRefinementDeployments method. + # @!attribute [rw] all_findings_refinement_deployments + # @return [::Array<::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment>] + # List of all findings refinement deployments. + # @!attribute [rw] next_page_token + # @return [::String] + # A token, which can be sent as `page_token` to retrieve the next page. If + # this field is omitted, there are no subsequent pages. + class ListAllFindingsRefinementDeploymentsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Outcome filter for the findings refinement. This is used to filter the + # findings refinement based on the outcome variable values. + # @!attribute [rw] outcome_variable + # @return [::String] + # Required. The outcome variable name. + # @!attribute [rw] outcome_value + # @return [::String] + # Required. The value of the outcome variable to match. + # @!attribute [rw] outcome_filter_operator + # @return [::Google::Cloud::Chronicle::V1::OutcomeFilter::Operator] + # Required. The operator to be applied to the outcome variable. + class OutcomeFilter + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The operator to compare the outcome variable value with the outcome value + # in the outcome filter. + module Operator + # The operator is unspecified. + OPERATOR_UNSPECIFIED = 0 + + # The outcome variable value must be equal to the outcome value in the + # outcome filter. + EQUAL = 1 + + # The outcome variable value must contain the outcome value in the + # outcome filter. + CONTAINS = 2 + + # The outcome variable value must match the outcome value regex in the + # outcome filter. + MATCHES_REGEX = 3 + + # The outcome variable value must be a valid IP address in the outcome + # filter value CIDR range. + MATCHES_CIDR = 4 + end + end + + # Request message for ComputeFindingsRefinementActivity method. + # @!attribute [rw] name + # @return [::String] + # Required. Full resource name for the findings refinement to fetch the + # activity for. Format: + # projects/\\{project}/locations/\\{region}/instances/\\{instance}/findingsRefinements/\\{findings_refinement} + # @!attribute [rw] interval + # @return [::Google::Type::Interval] + # The time interval the activity is measured over. + class ComputeFindingsRefinementActivityRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ComputeFindingsRefinementActivity method. + # @!attribute [rw] activity + # @return [::Google::Cloud::Chronicle::V1::FindingsRefinementActivity] + # The activity for the findings refinement. + class ComputeFindingsRefinementActivityResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ComputeAllFindingsRefinementActivities method. + # @!attribute [rw] instance + # @return [::String] + # Required. The ID of the Instance to retrieve counts for. + # Format: + # projects/\\{project}/locations/\\{location}/instances/\\{instance} + # @!attribute [rw] interval + # @return [::Google::Type::Interval] + # The time interval the activity is measured over. + class ComputeAllFindingsRefinementActivitiesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ComputeAllFindingsRefinementActivities method. + # @!attribute [rw] activities + # @return [::Array<::Google::Cloud::Chronicle::V1::FindingsRefinementActivity>] + # The activities of all findings refinements. + class ComputeAllFindingsRefinementActivitiesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The type of findings refinement, which determines what the findings + # refinement runs over and the mechanism by which it runs. + module FindingsRefinementType + # The findings refinement type is unspecified. + FINDINGS_REFINEMENT_TYPE_UNSPECIFIED = 0 + + # Indicates that the findings refinement is a detection exclusion and + # should exclude matching detections. + DETECTION_EXCLUSION = 1 + end + end + end + end +end diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_all_findings_refinement_activities.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_all_findings_refinement_activities.rb new file mode 100644 index 000000000000..786e30be8924 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_all_findings_refinement_activities.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_ComputeAllFindingsRefinementActivities_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the compute_all_findings_refinement_activities call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_all_findings_refinement_activities. +# +def compute_all_findings_refinement_activities + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new + + # Call the compute_all_findings_refinement_activities method. + result = client.compute_all_findings_refinement_activities request + + # The returned object is of type Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_ComputeAllFindingsRefinementActivities_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_findings_refinement_activity.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_findings_refinement_activity.rb new file mode 100644 index 000000000000..e28517aaa1c6 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/compute_findings_refinement_activity.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_ComputeFindingsRefinementActivity_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the compute_findings_refinement_activity call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_findings_refinement_activity. +# +def compute_findings_refinement_activity + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new + + # Call the compute_findings_refinement_activity method. + result = client.compute_findings_refinement_activity request + + # The returned object is of type Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_ComputeFindingsRefinementActivity_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/create_findings_refinement.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/create_findings_refinement.rb new file mode 100644 index 000000000000..be25f86f0d10 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/create_findings_refinement.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_CreateFindingsRefinement_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the create_findings_refinement call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#create_findings_refinement. +# +def create_findings_refinement + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new + + # Call the create_findings_refinement method. + result = client.create_findings_refinement request + + # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_CreateFindingsRefinement_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement.rb new file mode 100644 index 000000000000..2b427b36bc5c --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinement_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the get_findings_refinement call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement. +# +def get_findings_refinement + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new + + # Call the get_findings_refinement method. + result = client.get_findings_refinement request + + # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinement_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement_deployment.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement_deployment.rb new file mode 100644 index 000000000000..c4594f1b22fd --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/get_findings_refinement_deployment.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinementDeployment_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the get_findings_refinement_deployment call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement_deployment. +# +def get_findings_refinement_deployment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new + + # Call the get_findings_refinement_deployment method. + result = client.get_findings_refinement_deployment request + + # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinementDeployment_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_all_findings_refinement_deployments.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_all_findings_refinement_deployments.rb new file mode 100644 index 000000000000..20161b47cd31 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_all_findings_refinement_deployments.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_ListAllFindingsRefinementDeployments_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the list_all_findings_refinement_deployments call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_all_findings_refinement_deployments. +# +def list_all_findings_refinement_deployments + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new + + # Call the list_all_findings_refinement_deployments method. + result = client.list_all_findings_refinement_deployments request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + p item + end +end +# [END chronicle_v1_generated_FindingsRefinementService_ListAllFindingsRefinementDeployments_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_findings_refinements.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_findings_refinements.rb new file mode 100644 index 000000000000..53742fa09d67 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/list_findings_refinements.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_ListFindingsRefinements_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the list_findings_refinements call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_findings_refinements. +# +def list_findings_refinements + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new + + # Call the list_findings_refinements method. + result = client.list_findings_refinements request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Chronicle::V1::FindingsRefinement. + p item + end +end +# [END chronicle_v1_generated_FindingsRefinementService_ListFindingsRefinements_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement.rb new file mode 100644 index 000000000000..9b9322a28c34 --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinement_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the update_findings_refinement call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement. +# +def update_findings_refinement + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new + + # Call the update_findings_refinement method. + result = client.update_findings_refinement request + + # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinement. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinement_sync] diff --git a/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement_deployment.rb b/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement_deployment.rb new file mode 100644 index 000000000000..c91375ee846f --- /dev/null +++ b/google-cloud-chronicle-v1/snippets/findings_refinement_service/update_findings_refinement_deployment.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinementDeployment_sync] +require "google/cloud/chronicle/v1" + +## +# Snippet for the update_findings_refinement_deployment call in the FindingsRefinementService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement_deployment. +# +def update_findings_refinement_deployment + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new + + # Call the update_findings_refinement_deployment method. + result = client.update_findings_refinement_deployment request + + # The returned object is of type Google::Cloud::Chronicle::V1::FindingsRefinementDeployment. + p result +end +# [END chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinementDeployment_sync] diff --git a/google-cloud-chronicle-v1/snippets/snippet_metadata_google.cloud.chronicle.v1.json b/google-cloud-chronicle-v1/snippets/snippet_metadata_google.cloud.chronicle.v1.json index 5fe3ac411ff4..c69786b08e83 100644 --- a/google-cloud-chronicle-v1/snippets/snippet_metadata_google.cloud.chronicle.v1.json +++ b/google-cloud-chronicle-v1/snippets/snippet_metadata_google.cloud.chronicle.v1.json @@ -2091,6 +2091,366 @@ } ] }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinement_sync", + "title": "Snippet for the get_findings_refinement call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement.", + "file": "findings_refinement_service/get_findings_refinement.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_findings_refinement", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::FindingsRefinement", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "GetFindingsRefinement", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.GetFindingsRefinement", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_ListFindingsRefinements_sync", + "title": "Snippet for the list_findings_refinements call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_findings_refinements.", + "file": "findings_refinement_service/list_findings_refinements.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_findings_refinements", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_findings_refinements", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "ListFindingsRefinements", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.ListFindingsRefinements", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_CreateFindingsRefinement_sync", + "title": "Snippet for the create_findings_refinement call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#create_findings_refinement.", + "file": "findings_refinement_service/create_findings_refinement.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_findings_refinement", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#create_findings_refinement", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::FindingsRefinement", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "CreateFindingsRefinement", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.CreateFindingsRefinement", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinement_sync", + "title": "Snippet for the update_findings_refinement call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement.", + "file": "findings_refinement_service/update_findings_refinement.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_findings_refinement", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::FindingsRefinement", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "UpdateFindingsRefinement", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.UpdateFindingsRefinement", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_GetFindingsRefinementDeployment_sync", + "title": "Snippet for the get_findings_refinement_deployment call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement_deployment.", + "file": "findings_refinement_service/get_findings_refinement_deployment.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_findings_refinement_deployment", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#get_findings_refinement_deployment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "GetFindingsRefinementDeployment", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.GetFindingsRefinementDeployment", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_UpdateFindingsRefinementDeployment_sync", + "title": "Snippet for the update_findings_refinement_deployment call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement_deployment.", + "file": "findings_refinement_service/update_findings_refinement_deployment.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_findings_refinement_deployment", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#update_findings_refinement_deployment", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "UpdateFindingsRefinementDeployment", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.UpdateFindingsRefinementDeployment", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_ListAllFindingsRefinementDeployments_sync", + "title": "Snippet for the list_all_findings_refinement_deployments call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_all_findings_refinement_deployments.", + "file": "findings_refinement_service/list_all_findings_refinement_deployments.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_all_findings_refinement_deployments", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#list_all_findings_refinement_deployments", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "ListAllFindingsRefinementDeployments", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.ListAllFindingsRefinementDeployments", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_ComputeFindingsRefinementActivity_sync", + "title": "Snippet for the compute_findings_refinement_activity call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_findings_refinement_activity.", + "file": "findings_refinement_service/compute_findings_refinement_activity.rb", + "language": "RUBY", + "client_method": { + "short_name": "compute_findings_refinement_activity", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_findings_refinement_activity", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "ComputeFindingsRefinementActivity", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.ComputeFindingsRefinementActivity", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "chronicle_v1_generated_FindingsRefinementService_ComputeAllFindingsRefinementActivities_sync", + "title": "Snippet for the compute_all_findings_refinement_activities call in the FindingsRefinementService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_all_findings_refinement_activities.", + "file": "findings_refinement_service/compute_all_findings_refinement_activities.rb", + "language": "RUBY", + "client_method": { + "short_name": "compute_all_findings_refinement_activities", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client#compute_all_findings_refinement_activities", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse", + "client": { + "short_name": "FindingsRefinementService::Client", + "full_name": "::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client" + }, + "method": { + "short_name": "ComputeAllFindingsRefinementActivities", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService.ComputeAllFindingsRefinementActivities", + "service": { + "short_name": "FindingsRefinementService", + "full_name": "google.cloud.chronicle.v1.FindingsRefinementService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, { "region_tag": "chronicle_v1_generated_InstanceService_GetInstance_sync", "title": "Snippet for the get_instance call in the InstanceService service", diff --git a/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_paths_test.rb b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_paths_test.rb new file mode 100644 index 000000000000..96283ba1ce4e --- /dev/null +++ b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_paths_test.rb @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/chronicle/v1/findings_refinement_service" + +class ::Google::Cloud::Chronicle::V1::FindingsRefinementService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_curated_rule_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.curated_rule_path project: "value0", location: "value1", instance: "value2", curated_rule: "value3" + assert_equal "projects/value0/locations/value1/instances/value2/curatedRules/value3", path + end + end + + def test_curated_rule_set_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.curated_rule_set_path project: "value0", location: "value1", instance: "value2", category: "value3", rule_set: "value4" + assert_equal "projects/value0/locations/value1/instances/value2/curatedRuleSetCategories/value3/curatedRuleSets/value4", path + end + end + + def test_findings_refinement_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.findings_refinement_path project: "value0", location: "value1", instance: "value2", findings_refinement: "value3" + assert_equal "projects/value0/locations/value1/instances/value2/findingsRefinements/value3", path + end + end + + def test_findings_refinement_deployment_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.findings_refinement_deployment_path project: "value0", location: "value1", instance: "value2", findings_refinement: "value3" + assert_equal "projects/value0/locations/value1/instances/value2/findingsRefinements/value3/deployment", path + end + end + + def test_instance_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.instance_path project: "value0", location: "value1", instance: "value2" + assert_equal "projects/value0/locations/value1/instances/value2", path + end + end + + def test_rule_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.rule_path project: "value0", location: "value1", instance: "value2", rule: "value3" + assert_equal "projects/value0/locations/value1/instances/value2/rules/value3", path + end + end +end diff --git a/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_rest_test.rb b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_rest_test.rb new file mode 100644 index 000000000000..12e44c344878 --- /dev/null +++ b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_rest_test.rb @@ -0,0 +1,595 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/chronicle/v1/findings_refinement_pb" +require "google/cloud/chronicle/v1/findings_refinement_service/rest" + + +class ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get_findings_refinement + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_findings_refinement_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_get_findings_refinement_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_findings_refinement({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_findings_refinement name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_findings_refinement ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_findings_refinement({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_findings_refinement(::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_findings_refinement_client_stub.call_count + end + end + end + + def test_list_findings_refinements + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_findings_refinements_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_list_findings_refinements_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_findings_refinements_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_findings_refinements({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_findings_refinements parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_findings_refinements ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_findings_refinements({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_findings_refinements(::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_findings_refinements_client_stub.call_count + end + end + end + + def test_create_findings_refinement + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + findings_refinement = {} + + create_findings_refinement_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_create_findings_refinement_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_findings_refinement({ parent: parent, findings_refinement: findings_refinement }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_findings_refinement parent: parent, findings_refinement: findings_refinement do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_findings_refinement ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new(parent: parent, findings_refinement: findings_refinement) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_findings_refinement({ parent: parent, findings_refinement: findings_refinement }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_findings_refinement(::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new(parent: parent, findings_refinement: findings_refinement), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_findings_refinement_client_stub.call_count + end + end + end + + def test_update_findings_refinement + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + findings_refinement = {} + update_mask = {} + + update_findings_refinement_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_update_findings_refinement_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_findings_refinement({ findings_refinement: findings_refinement, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_findings_refinement findings_refinement: findings_refinement, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_findings_refinement ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new(findings_refinement: findings_refinement, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_findings_refinement({ findings_refinement: findings_refinement, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_findings_refinement(::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new(findings_refinement: findings_refinement, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_findings_refinement_client_stub.call_count + end + end + end + + def test_get_findings_refinement_deployment + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_findings_refinement_deployment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_get_findings_refinement_deployment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_findings_refinement_deployment_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_findings_refinement_deployment({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_findings_refinement_deployment name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_findings_refinement_deployment ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_findings_refinement_deployment({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_findings_refinement_deployment(::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_findings_refinement_deployment_client_stub.call_count + end + end + end + + def test_update_findings_refinement_deployment + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + findings_refinement_deployment = {} + update_mask = {} + + update_findings_refinement_deployment_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_update_findings_refinement_deployment_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_findings_refinement_deployment_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_findings_refinement_deployment({ findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_findings_refinement_deployment findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_findings_refinement_deployment ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new(findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_findings_refinement_deployment({ findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_findings_refinement_deployment(::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new(findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_findings_refinement_deployment_client_stub.call_count + end + end + end + + def test_list_all_findings_refinement_deployments + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_all_findings_refinement_deployments_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_list_all_findings_refinement_deployments_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_all_findings_refinement_deployments_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_all_findings_refinement_deployments({ instance: instance, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_all_findings_refinement_deployments instance: instance, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_all_findings_refinement_deployments ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new(instance: instance, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_all_findings_refinement_deployments({ instance: instance, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_all_findings_refinement_deployments(::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new(instance: instance, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_all_findings_refinement_deployments_client_stub.call_count + end + end + end + + def test_compute_findings_refinement_activity + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + interval = {} + + compute_findings_refinement_activity_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_compute_findings_refinement_activity_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, compute_findings_refinement_activity_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.compute_findings_refinement_activity({ name: name, interval: interval }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.compute_findings_refinement_activity name: name, interval: interval do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.compute_findings_refinement_activity ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new(name: name, interval: interval) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.compute_findings_refinement_activity({ name: name, interval: interval }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.compute_findings_refinement_activity(::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new(name: name, interval: interval), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, compute_findings_refinement_activity_client_stub.call_count + end + end + end + + def test_compute_all_findings_refinement_activities + # Create test objects. + client_result = ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + interval = {} + + compute_all_findings_refinement_activities_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::ServiceStub.stub :transcode_compute_all_findings_refinement_activities_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, compute_all_findings_refinement_activities_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.compute_all_findings_refinement_activities({ instance: instance, interval: interval }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.compute_all_findings_refinement_activities instance: instance, interval: interval do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.compute_all_findings_refinement_activities ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new(instance: instance, interval: interval) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.compute_all_findings_refinement_activities({ instance: instance, interval: interval }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.compute_all_findings_refinement_activities(::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new(instance: instance, interval: interval), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, compute_all_findings_refinement_activities_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Rest::Client::Configuration, config + end +end diff --git a/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_test.rb b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_test.rb new file mode 100644 index 000000000000..3afdfe7d1608 --- /dev/null +++ b/google-cloud-chronicle-v1/test/google/cloud/chronicle/v1/findings_refinement_service_test.rb @@ -0,0 +1,656 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/chronicle/v1/findings_refinement_pb" +require "google/cloud/chronicle/v1/findings_refinement_service" + +class ::Google::Cloud::Chronicle::V1::FindingsRefinementService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_get_findings_refinement + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_findings_refinement_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_findings_refinement, name + assert_kind_of ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_findings_refinement({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_findings_refinement name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_findings_refinement ::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_findings_refinement({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_findings_refinement(::Google::Cloud::Chronicle::V1::GetFindingsRefinementRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_findings_refinement_client_stub.call_rpc_count + end + end + + def test_list_findings_refinements + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_findings_refinements_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_findings_refinements, name + assert_kind_of ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_findings_refinements_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_findings_refinements({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_findings_refinements parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_findings_refinements ::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_findings_refinements({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_findings_refinements(::Google::Cloud::Chronicle::V1::ListFindingsRefinementsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_findings_refinements_client_stub.call_rpc_count + end + end + + def test_create_findings_refinement + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + findings_refinement = {} + + create_findings_refinement_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_findings_refinement, name + assert_kind_of ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Chronicle::V1::FindingsRefinement), request["findings_refinement"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_findings_refinement({ parent: parent, findings_refinement: findings_refinement }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_findings_refinement parent: parent, findings_refinement: findings_refinement do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_findings_refinement ::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new(parent: parent, findings_refinement: findings_refinement) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_findings_refinement({ parent: parent, findings_refinement: findings_refinement }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_findings_refinement(::Google::Cloud::Chronicle::V1::CreateFindingsRefinementRequest.new(parent: parent, findings_refinement: findings_refinement), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_findings_refinement_client_stub.call_rpc_count + end + end + + def test_update_findings_refinement + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::FindingsRefinement.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + findings_refinement = {} + update_mask = {} + + update_findings_refinement_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_findings_refinement, name + assert_kind_of ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Chronicle::V1::FindingsRefinement), request["findings_refinement"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_findings_refinement_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_findings_refinement({ findings_refinement: findings_refinement, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_findings_refinement findings_refinement: findings_refinement, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_findings_refinement ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new(findings_refinement: findings_refinement, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_findings_refinement({ findings_refinement: findings_refinement, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_findings_refinement(::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementRequest.new(findings_refinement: findings_refinement, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_findings_refinement_client_stub.call_rpc_count + end + end + + def test_get_findings_refinement_deployment + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_findings_refinement_deployment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_findings_refinement_deployment, name + assert_kind_of ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_findings_refinement_deployment_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_findings_refinement_deployment({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_findings_refinement_deployment name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_findings_refinement_deployment ::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_findings_refinement_deployment({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_findings_refinement_deployment(::Google::Cloud::Chronicle::V1::GetFindingsRefinementDeploymentRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_findings_refinement_deployment_client_stub.call_rpc_count + end + end + + def test_update_findings_refinement_deployment + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + findings_refinement_deployment = {} + update_mask = {} + + update_findings_refinement_deployment_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_findings_refinement_deployment, name + assert_kind_of ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Chronicle::V1::FindingsRefinementDeployment), request["findings_refinement_deployment"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_findings_refinement_deployment_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_findings_refinement_deployment({ findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_findings_refinement_deployment findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_findings_refinement_deployment ::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new(findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_findings_refinement_deployment({ findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_findings_refinement_deployment(::Google::Cloud::Chronicle::V1::UpdateFindingsRefinementDeploymentRequest.new(findings_refinement_deployment: findings_refinement_deployment, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_findings_refinement_deployment_client_stub.call_rpc_count + end + end + + def test_list_all_findings_refinement_deployments + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_all_findings_refinement_deployments_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_all_findings_refinement_deployments, name + assert_kind_of ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest, request + assert_equal "hello world", request["instance"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_all_findings_refinement_deployments_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_all_findings_refinement_deployments({ instance: instance, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_all_findings_refinement_deployments instance: instance, page_size: page_size, page_token: page_token, filter: filter do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_all_findings_refinement_deployments ::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new(instance: instance, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_all_findings_refinement_deployments({ instance: instance, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_all_findings_refinement_deployments(::Google::Cloud::Chronicle::V1::ListAllFindingsRefinementDeploymentsRequest.new(instance: instance, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_all_findings_refinement_deployments_client_stub.call_rpc_count + end + end + + def test_compute_findings_refinement_activity + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + interval = {} + + compute_findings_refinement_activity_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :compute_findings_refinement_activity, name + assert_kind_of ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Type::Interval), request["interval"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, compute_findings_refinement_activity_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.compute_findings_refinement_activity({ name: name, interval: interval }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.compute_findings_refinement_activity name: name, interval: interval do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.compute_findings_refinement_activity ::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new(name: name, interval: interval) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.compute_findings_refinement_activity({ name: name, interval: interval }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.compute_findings_refinement_activity(::Google::Cloud::Chronicle::V1::ComputeFindingsRefinementActivityRequest.new(name: name, interval: interval), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, compute_findings_refinement_activity_client_stub.call_rpc_count + end + end + + def test_compute_all_findings_refinement_activities + # Create GRPC objects. + grpc_response = ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + instance = "hello world" + interval = {} + + compute_all_findings_refinement_activities_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :compute_all_findings_refinement_activities, name + assert_kind_of ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest, request + assert_equal "hello world", request["instance"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Type::Interval), request["interval"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, compute_all_findings_refinement_activities_client_stub do + # Create client + c = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.compute_all_findings_refinement_activities({ instance: instance, interval: interval }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.compute_all_findings_refinement_activities instance: instance, interval: interval do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.compute_all_findings_refinement_activities ::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new(instance: instance, interval: interval) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.compute_all_findings_refinement_activities({ instance: instance, interval: interval }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.compute_all_findings_refinement_activities(::Google::Cloud::Chronicle::V1::ComputeAllFindingsRefinementActivitiesRequest.new(instance: instance, interval: interval), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, compute_all_findings_refinement_activities_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Chronicle::V1::FindingsRefinementService::Client, client + assert_equal creds, client.configure.credentials + end + end +end