google-cloud-dlp-v2 0.18.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,9 @@ module Google
39
39
  # https://cloud.google.com/dlp/docs/.
40
40
  #
41
41
  class Client
42
+ # @private
43
+ DEFAULT_ENDPOINT_TEMPLATE = "dlp.$UNIVERSE_DOMAIN$"
44
+
42
45
  include Paths
43
46
 
44
47
  # @private
@@ -159,6 +162,25 @@ module Google
159
162
 
160
163
  default_config.rpcs.activate_job_trigger.timeout = 300.0
161
164
 
165
+ default_config.rpcs.create_discovery_config.timeout = 300.0
166
+
167
+ default_config.rpcs.update_discovery_config.timeout = 300.0
168
+
169
+ default_config.rpcs.get_discovery_config.timeout = 300.0
170
+ default_config.rpcs.get_discovery_config.retry_policy = {
171
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
172
+ }
173
+
174
+ default_config.rpcs.list_discovery_configs.timeout = 300.0
175
+ default_config.rpcs.list_discovery_configs.retry_policy = {
176
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
177
+ }
178
+
179
+ default_config.rpcs.delete_discovery_config.timeout = 300.0
180
+ default_config.rpcs.delete_discovery_config.retry_policy = {
181
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
182
+ }
183
+
162
184
  default_config.rpcs.create_dlp_job.timeout = 300.0
163
185
 
164
186
  default_config.rpcs.list_dlp_jobs.timeout = 300.0
@@ -227,6 +249,15 @@ module Google
227
249
  @config
228
250
  end
229
251
 
252
+ ##
253
+ # The effective universe domain
254
+ #
255
+ # @return [String]
256
+ #
257
+ def universe_domain
258
+ @dlp_service_stub.universe_domain
259
+ end
260
+
230
261
  ##
231
262
  # Create a new DlpService client object.
232
263
  #
@@ -260,8 +291,9 @@ module Google
260
291
  credentials = @config.credentials
261
292
  # Use self-signed JWT if the endpoint is unchanged from default,
262
293
  # but only if the default endpoint does not have a region prefix.
263
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
264
- !@config.endpoint.split(".").first.include?("-")
294
+ enable_self_signed_jwt = @config.endpoint.nil? ||
295
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
296
+ !@config.endpoint.split(".").first.include?("-"))
265
297
  credentials ||= Credentials.default scope: @config.scope,
266
298
  enable_self_signed_jwt: enable_self_signed_jwt
267
299
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -274,12 +306,15 @@ module Google
274
306
  config.credentials = credentials
275
307
  config.quota_project = @quota_project_id
276
308
  config.endpoint = @config.endpoint
309
+ config.universe_domain = @config.universe_domain
277
310
  end
278
311
 
279
312
  @dlp_service_stub = ::Gapic::ServiceStub.new(
280
313
  ::Google::Cloud::Dlp::V2::DlpService::Stub,
281
- credentials: credentials,
282
- endpoint: @config.endpoint,
314
+ credentials: credentials,
315
+ endpoint: @config.endpoint,
316
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
317
+ universe_domain: @config.universe_domain,
283
318
  channel_args: @config.channel_args,
284
319
  interceptors: @config.interceptors,
285
320
  channel_pool_config: @config.channel_pool
@@ -1033,8 +1068,8 @@ module Google
1033
1068
  # the default parameter values, pass an empty Hash as a request object (see above).
1034
1069
  #
1035
1070
  # @param name [::String]
1036
- # Required. Resource name of organization and inspectTemplate to be updated, for
1037
- # example `organizations/433245324/inspectTemplates/432452342` or
1071
+ # Required. Resource name of organization and inspectTemplate to be updated,
1072
+ # for example `organizations/433245324/inspectTemplates/432452342` or
1038
1073
  # projects/project-id/inspectTemplates/432452342.
1039
1074
  # @param inspect_template [::Google::Cloud::Dlp::V2::InspectTemplate, ::Hash]
1040
1075
  # New InspectTemplate value.
@@ -1125,8 +1160,8 @@ module Google
1125
1160
  # the default parameter values, pass an empty Hash as a request object (see above).
1126
1161
  #
1127
1162
  # @param name [::String]
1128
- # Required. Resource name of the organization and inspectTemplate to be read, for
1129
- # example `organizations/433245324/inspectTemplates/432452342` or
1163
+ # Required. Resource name of the organization and inspectTemplate to be read,
1164
+ # for example `organizations/433245324/inspectTemplates/432452342` or
1130
1165
  # projects/project-id/inspectTemplates/432452342.
1131
1166
  #
1132
1167
  # @yield [response, operation] Access the result along with the RPC operation
@@ -1234,15 +1269,15 @@ module Google
1234
1269
  #
1235
1270
  # parent=projects/example-project/locations/europe-west3
1236
1271
  # @param page_token [::String]
1237
- # Page token to continue retrieval. Comes from previous call
1272
+ # Page token to continue retrieval. Comes from the previous call
1238
1273
  # to `ListInspectTemplates`.
1239
1274
  # @param page_size [::Integer]
1240
- # Size of the page, can be limited by the server. If zero server returns
1241
- # a page of max size 100.
1275
+ # Size of the page. This value can be limited by the server. If zero server
1276
+ # returns a page of max size 100.
1242
1277
  # @param order_by [::String]
1243
1278
  # Comma separated list of fields to order by,
1244
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1245
- # default sorting order is ascending, redundant space characters are
1279
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
1280
+ # default sorting order is ascending. Redundant space characters are
1246
1281
  # insignificant.
1247
1282
  #
1248
1283
  # Example: `name asc,update_time, create_time desc`
@@ -1345,9 +1380,9 @@ module Google
1345
1380
  # the default parameter values, pass an empty Hash as a request object (see above).
1346
1381
  #
1347
1382
  # @param name [::String]
1348
- # Required. Resource name of the organization and inspectTemplate to be deleted, for
1349
- # example `organizations/433245324/inspectTemplates/432452342` or
1350
- # projects/project-id/inspectTemplates/432452342.
1383
+ # Required. Resource name of the organization and inspectTemplate to be
1384
+ # deleted, for example `organizations/433245324/inspectTemplates/432452342`
1385
+ # or projects/project-id/inspectTemplates/432452342.
1351
1386
  #
1352
1387
  # @yield [response, operation] Access the result along with the RPC operation
1353
1388
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -1550,8 +1585,9 @@ module Google
1550
1585
  # the default parameter values, pass an empty Hash as a request object (see above).
1551
1586
  #
1552
1587
  # @param name [::String]
1553
- # Required. Resource name of organization and deidentify template to be updated, for
1554
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1588
+ # Required. Resource name of organization and deidentify template to be
1589
+ # updated, for example
1590
+ # `organizations/433245324/deidentifyTemplates/432452342` or
1555
1591
  # projects/project-id/deidentifyTemplates/432452342.
1556
1592
  # @param deidentify_template [::Google::Cloud::Dlp::V2::DeidentifyTemplate, ::Hash]
1557
1593
  # New DeidentifyTemplate value.
@@ -1643,9 +1679,9 @@ module Google
1643
1679
  # the default parameter values, pass an empty Hash as a request object (see above).
1644
1680
  #
1645
1681
  # @param name [::String]
1646
- # Required. Resource name of the organization and deidentify template to be read, for
1647
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1648
- # projects/project-id/deidentifyTemplates/432452342.
1682
+ # Required. Resource name of the organization and deidentify template to be
1683
+ # read, for example `organizations/433245324/deidentifyTemplates/432452342`
1684
+ # or projects/project-id/deidentifyTemplates/432452342.
1649
1685
  #
1650
1686
  # @yield [response, operation] Access the result along with the RPC operation
1651
1687
  # @yieldparam response [::Google::Cloud::Dlp::V2::DeidentifyTemplate]
@@ -1753,15 +1789,15 @@ module Google
1753
1789
  #
1754
1790
  # parent=projects/example-project/locations/europe-west3
1755
1791
  # @param page_token [::String]
1756
- # Page token to continue retrieval. Comes from previous call
1792
+ # Page token to continue retrieval. Comes from the previous call
1757
1793
  # to `ListDeidentifyTemplates`.
1758
1794
  # @param page_size [::Integer]
1759
- # Size of the page, can be limited by the server. If zero server returns
1760
- # a page of max size 100.
1795
+ # Size of the page. This value can be limited by the server. If zero server
1796
+ # returns a page of max size 100.
1761
1797
  # @param order_by [::String]
1762
1798
  # Comma separated list of fields to order by,
1763
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1764
- # default sorting order is ascending, redundant space characters are
1799
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
1800
+ # default sorting order is ascending. Redundant space characters are
1765
1801
  # insignificant.
1766
1802
  #
1767
1803
  # Example: `name asc,update_time, create_time desc`
@@ -1865,8 +1901,9 @@ module Google
1865
1901
  # the default parameter values, pass an empty Hash as a request object (see above).
1866
1902
  #
1867
1903
  # @param name [::String]
1868
- # Required. Resource name of the organization and deidentify template to be deleted,
1869
- # for example `organizations/433245324/deidentifyTemplates/432452342` or
1904
+ # Required. Resource name of the organization and deidentify template to be
1905
+ # deleted, for example
1906
+ # `organizations/433245324/deidentifyTemplates/432452342` or
1870
1907
  # projects/project-id/deidentifyTemplates/432452342.
1871
1908
  #
1872
1909
  # @yield [response, operation] Access the result along with the RPC operation
@@ -2156,8 +2193,8 @@ module Google
2156
2193
  # the default parameter values, pass an empty Hash as a request object (see above).
2157
2194
  #
2158
2195
  # @param name [::String]
2159
- # Required. Resource name of the trigger to execute a hybrid inspect on, for example
2160
- # `projects/dlp-test-project/jobTriggers/53234423`.
2196
+ # Required. Resource name of the trigger to execute a hybrid inspect on, for
2197
+ # example `projects/dlp-test-project/jobTriggers/53234423`.
2161
2198
  # @param hybrid_item [::Google::Cloud::Dlp::V2::HybridContentItem, ::Hash]
2162
2199
  # The item to inspect.
2163
2200
  #
@@ -2349,15 +2386,15 @@ module Google
2349
2386
  #
2350
2387
  # parent=projects/example-project/locations/europe-west3
2351
2388
  # @param page_token [::String]
2352
- # Page token to continue retrieval. Comes from previous call
2389
+ # Page token to continue retrieval. Comes from the previous call
2353
2390
  # to ListJobTriggers. `order_by` field must not
2354
2391
  # change for subsequent calls.
2355
2392
  # @param page_size [::Integer]
2356
- # Size of the page, can be limited by a server.
2393
+ # Size of the page. This value can be limited by a server.
2357
2394
  # @param order_by [::String]
2358
2395
  # Comma separated list of triggeredJob fields to order by,
2359
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
2360
- # default sorting order is ascending, redundant space characters are
2396
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
2397
+ # default sorting order is ascending. Redundant space characters are
2361
2398
  # insignificant.
2362
2399
  #
2363
2400
  # Example: `name asc,update_time, create_time desc`
@@ -2643,6 +2680,487 @@ module Google
2643
2680
  raise ::Google::Cloud::Error.from_error(e)
2644
2681
  end
2645
2682
 
2683
+ ##
2684
+ # Creates a config for discovery to scan and profile storage.
2685
+ #
2686
+ # @overload create_discovery_config(request, options = nil)
2687
+ # Pass arguments to `create_discovery_config` via a request object, either of type
2688
+ # {::Google::Cloud::Dlp::V2::CreateDiscoveryConfigRequest} or an equivalent Hash.
2689
+ #
2690
+ # @param request [::Google::Cloud::Dlp::V2::CreateDiscoveryConfigRequest, ::Hash]
2691
+ # A request object representing the call parameters. Required. To specify no
2692
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2693
+ # @param options [::Gapic::CallOptions, ::Hash]
2694
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2695
+ #
2696
+ # @overload create_discovery_config(parent: nil, discovery_config: nil, config_id: nil)
2697
+ # Pass arguments to `create_discovery_config` via keyword arguments. Note that at
2698
+ # least one keyword argument is required. To specify no parameters, or to keep all
2699
+ # the default parameter values, pass an empty Hash as a request object (see above).
2700
+ #
2701
+ # @param parent [::String]
2702
+ # Required. Parent resource name.
2703
+ #
2704
+ # The format of this value is as follows:
2705
+ # `projects/`<var>PROJECT_ID</var>`/locations/`<var>LOCATION_ID</var>
2706
+ #
2707
+ # The following example `parent` string specifies a parent project with the
2708
+ # identifier `example-project`, and specifies the `europe-west3` location
2709
+ # for processing data:
2710
+ #
2711
+ # parent=projects/example-project/locations/europe-west3
2712
+ # @param discovery_config [::Google::Cloud::Dlp::V2::DiscoveryConfig, ::Hash]
2713
+ # Required. The DiscoveryConfig to create.
2714
+ # @param config_id [::String]
2715
+ # The config ID can contain uppercase and lowercase letters,
2716
+ # numbers, and hyphens; that is, it must match the regular
2717
+ # expression: `[a-zA-Z\d-_]+`. The maximum length is 100
2718
+ # characters. Can be empty to allow the system to generate one.
2719
+ #
2720
+ # @yield [response, operation] Access the result along with the RPC operation
2721
+ # @yieldparam response [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2722
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2723
+ #
2724
+ # @return [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2725
+ #
2726
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2727
+ #
2728
+ # @example Basic example
2729
+ # require "google/cloud/dlp/v2"
2730
+ #
2731
+ # # Create a client object. The client can be reused for multiple calls.
2732
+ # client = Google::Cloud::Dlp::V2::DlpService::Client.new
2733
+ #
2734
+ # # Create a request. To set request fields, pass in keyword arguments.
2735
+ # request = Google::Cloud::Dlp::V2::CreateDiscoveryConfigRequest.new
2736
+ #
2737
+ # # Call the create_discovery_config method.
2738
+ # result = client.create_discovery_config request
2739
+ #
2740
+ # # The returned object is of type Google::Cloud::Dlp::V2::DiscoveryConfig.
2741
+ # p result
2742
+ #
2743
+ def create_discovery_config request, options = nil
2744
+ raise ::ArgumentError, "request must be provided" if request.nil?
2745
+
2746
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dlp::V2::CreateDiscoveryConfigRequest
2747
+
2748
+ # Converts hash and nil to an options object
2749
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2750
+
2751
+ # Customize the options with defaults
2752
+ metadata = @config.rpcs.create_discovery_config.metadata.to_h
2753
+
2754
+ # Set x-goog-api-client and x-goog-user-project headers
2755
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2756
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2757
+ gapic_version: ::Google::Cloud::Dlp::V2::VERSION
2758
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2759
+
2760
+ header_params = {}
2761
+ if request.parent
2762
+ header_params["parent"] = request.parent
2763
+ end
2764
+
2765
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2766
+ metadata[:"x-goog-request-params"] ||= request_params_header
2767
+
2768
+ options.apply_defaults timeout: @config.rpcs.create_discovery_config.timeout,
2769
+ metadata: metadata,
2770
+ retry_policy: @config.rpcs.create_discovery_config.retry_policy
2771
+
2772
+ options.apply_defaults timeout: @config.timeout,
2773
+ metadata: @config.metadata,
2774
+ retry_policy: @config.retry_policy
2775
+
2776
+ @dlp_service_stub.call_rpc :create_discovery_config, request, options: options do |response, operation|
2777
+ yield response, operation if block_given?
2778
+ return response
2779
+ end
2780
+ rescue ::GRPC::BadStatus => e
2781
+ raise ::Google::Cloud::Error.from_error(e)
2782
+ end
2783
+
2784
+ ##
2785
+ # Updates a discovery configuration.
2786
+ #
2787
+ # @overload update_discovery_config(request, options = nil)
2788
+ # Pass arguments to `update_discovery_config` via a request object, either of type
2789
+ # {::Google::Cloud::Dlp::V2::UpdateDiscoveryConfigRequest} or an equivalent Hash.
2790
+ #
2791
+ # @param request [::Google::Cloud::Dlp::V2::UpdateDiscoveryConfigRequest, ::Hash]
2792
+ # A request object representing the call parameters. Required. To specify no
2793
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2794
+ # @param options [::Gapic::CallOptions, ::Hash]
2795
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2796
+ #
2797
+ # @overload update_discovery_config(name: nil, discovery_config: nil, update_mask: nil)
2798
+ # Pass arguments to `update_discovery_config` via keyword arguments. Note that at
2799
+ # least one keyword argument is required. To specify no parameters, or to keep all
2800
+ # the default parameter values, pass an empty Hash as a request object (see above).
2801
+ #
2802
+ # @param name [::String]
2803
+ # Required. Resource name of the project and the configuration, for example
2804
+ # `projects/dlp-test-project/discoveryConfigs/53234423`.
2805
+ # @param discovery_config [::Google::Cloud::Dlp::V2::DiscoveryConfig, ::Hash]
2806
+ # Required. New DiscoveryConfig value.
2807
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2808
+ # Mask to control which fields get updated.
2809
+ #
2810
+ # @yield [response, operation] Access the result along with the RPC operation
2811
+ # @yieldparam response [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2812
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2813
+ #
2814
+ # @return [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2815
+ #
2816
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2817
+ #
2818
+ # @example Basic example
2819
+ # require "google/cloud/dlp/v2"
2820
+ #
2821
+ # # Create a client object. The client can be reused for multiple calls.
2822
+ # client = Google::Cloud::Dlp::V2::DlpService::Client.new
2823
+ #
2824
+ # # Create a request. To set request fields, pass in keyword arguments.
2825
+ # request = Google::Cloud::Dlp::V2::UpdateDiscoveryConfigRequest.new
2826
+ #
2827
+ # # Call the update_discovery_config method.
2828
+ # result = client.update_discovery_config request
2829
+ #
2830
+ # # The returned object is of type Google::Cloud::Dlp::V2::DiscoveryConfig.
2831
+ # p result
2832
+ #
2833
+ def update_discovery_config request, options = nil
2834
+ raise ::ArgumentError, "request must be provided" if request.nil?
2835
+
2836
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dlp::V2::UpdateDiscoveryConfigRequest
2837
+
2838
+ # Converts hash and nil to an options object
2839
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2840
+
2841
+ # Customize the options with defaults
2842
+ metadata = @config.rpcs.update_discovery_config.metadata.to_h
2843
+
2844
+ # Set x-goog-api-client and x-goog-user-project headers
2845
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2846
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2847
+ gapic_version: ::Google::Cloud::Dlp::V2::VERSION
2848
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2849
+
2850
+ header_params = {}
2851
+ if request.name
2852
+ header_params["name"] = request.name
2853
+ end
2854
+
2855
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2856
+ metadata[:"x-goog-request-params"] ||= request_params_header
2857
+
2858
+ options.apply_defaults timeout: @config.rpcs.update_discovery_config.timeout,
2859
+ metadata: metadata,
2860
+ retry_policy: @config.rpcs.update_discovery_config.retry_policy
2861
+
2862
+ options.apply_defaults timeout: @config.timeout,
2863
+ metadata: @config.metadata,
2864
+ retry_policy: @config.retry_policy
2865
+
2866
+ @dlp_service_stub.call_rpc :update_discovery_config, request, options: options do |response, operation|
2867
+ yield response, operation if block_given?
2868
+ return response
2869
+ end
2870
+ rescue ::GRPC::BadStatus => e
2871
+ raise ::Google::Cloud::Error.from_error(e)
2872
+ end
2873
+
2874
+ ##
2875
+ # Gets a discovery configuration.
2876
+ #
2877
+ # @overload get_discovery_config(request, options = nil)
2878
+ # Pass arguments to `get_discovery_config` via a request object, either of type
2879
+ # {::Google::Cloud::Dlp::V2::GetDiscoveryConfigRequest} or an equivalent Hash.
2880
+ #
2881
+ # @param request [::Google::Cloud::Dlp::V2::GetDiscoveryConfigRequest, ::Hash]
2882
+ # A request object representing the call parameters. Required. To specify no
2883
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2884
+ # @param options [::Gapic::CallOptions, ::Hash]
2885
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2886
+ #
2887
+ # @overload get_discovery_config(name: nil)
2888
+ # Pass arguments to `get_discovery_config` via keyword arguments. Note that at
2889
+ # least one keyword argument is required. To specify no parameters, or to keep all
2890
+ # the default parameter values, pass an empty Hash as a request object (see above).
2891
+ #
2892
+ # @param name [::String]
2893
+ # Required. Resource name of the project and the configuration, for example
2894
+ # `projects/dlp-test-project/discoveryConfigs/53234423`.
2895
+ #
2896
+ # @yield [response, operation] Access the result along with the RPC operation
2897
+ # @yieldparam response [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2898
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2899
+ #
2900
+ # @return [::Google::Cloud::Dlp::V2::DiscoveryConfig]
2901
+ #
2902
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2903
+ #
2904
+ # @example Basic example
2905
+ # require "google/cloud/dlp/v2"
2906
+ #
2907
+ # # Create a client object. The client can be reused for multiple calls.
2908
+ # client = Google::Cloud::Dlp::V2::DlpService::Client.new
2909
+ #
2910
+ # # Create a request. To set request fields, pass in keyword arguments.
2911
+ # request = Google::Cloud::Dlp::V2::GetDiscoveryConfigRequest.new
2912
+ #
2913
+ # # Call the get_discovery_config method.
2914
+ # result = client.get_discovery_config request
2915
+ #
2916
+ # # The returned object is of type Google::Cloud::Dlp::V2::DiscoveryConfig.
2917
+ # p result
2918
+ #
2919
+ def get_discovery_config request, options = nil
2920
+ raise ::ArgumentError, "request must be provided" if request.nil?
2921
+
2922
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dlp::V2::GetDiscoveryConfigRequest
2923
+
2924
+ # Converts hash and nil to an options object
2925
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2926
+
2927
+ # Customize the options with defaults
2928
+ metadata = @config.rpcs.get_discovery_config.metadata.to_h
2929
+
2930
+ # Set x-goog-api-client and x-goog-user-project headers
2931
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2932
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2933
+ gapic_version: ::Google::Cloud::Dlp::V2::VERSION
2934
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2935
+
2936
+ header_params = {}
2937
+ if request.name
2938
+ header_params["name"] = request.name
2939
+ end
2940
+
2941
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2942
+ metadata[:"x-goog-request-params"] ||= request_params_header
2943
+
2944
+ options.apply_defaults timeout: @config.rpcs.get_discovery_config.timeout,
2945
+ metadata: metadata,
2946
+ retry_policy: @config.rpcs.get_discovery_config.retry_policy
2947
+
2948
+ options.apply_defaults timeout: @config.timeout,
2949
+ metadata: @config.metadata,
2950
+ retry_policy: @config.retry_policy
2951
+
2952
+ @dlp_service_stub.call_rpc :get_discovery_config, request, options: options do |response, operation|
2953
+ yield response, operation if block_given?
2954
+ return response
2955
+ end
2956
+ rescue ::GRPC::BadStatus => e
2957
+ raise ::Google::Cloud::Error.from_error(e)
2958
+ end
2959
+
2960
+ ##
2961
+ # Lists discovery configurations.
2962
+ #
2963
+ # @overload list_discovery_configs(request, options = nil)
2964
+ # Pass arguments to `list_discovery_configs` via a request object, either of type
2965
+ # {::Google::Cloud::Dlp::V2::ListDiscoveryConfigsRequest} or an equivalent Hash.
2966
+ #
2967
+ # @param request [::Google::Cloud::Dlp::V2::ListDiscoveryConfigsRequest, ::Hash]
2968
+ # A request object representing the call parameters. Required. To specify no
2969
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2970
+ # @param options [::Gapic::CallOptions, ::Hash]
2971
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2972
+ #
2973
+ # @overload list_discovery_configs(parent: nil, page_token: nil, page_size: nil, order_by: nil)
2974
+ # Pass arguments to `list_discovery_configs` via keyword arguments. Note that at
2975
+ # least one keyword argument is required. To specify no parameters, or to keep all
2976
+ # the default parameter values, pass an empty Hash as a request object (see above).
2977
+ #
2978
+ # @param parent [::String]
2979
+ # Required. Parent resource name.
2980
+ #
2981
+ # The format of this value is as follows:
2982
+ # `projects/`<var>PROJECT_ID</var>`/locations/`<var>LOCATION_ID</var>
2983
+ #
2984
+ # The following example `parent` string specifies a parent project with the
2985
+ # identifier `example-project`, and specifies the `europe-west3` location
2986
+ # for processing data:
2987
+ #
2988
+ # parent=projects/example-project/locations/europe-west3
2989
+ # @param page_token [::String]
2990
+ # Page token to continue retrieval. Comes from the previous call
2991
+ # to ListDiscoveryConfigs. `order_by` field must not
2992
+ # change for subsequent calls.
2993
+ # @param page_size [::Integer]
2994
+ # Size of the page. This value can be limited by a server.
2995
+ # @param order_by [::String]
2996
+ # Comma separated list of config fields to order by,
2997
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
2998
+ # default sorting order is ascending. Redundant space characters are
2999
+ # insignificant.
3000
+ #
3001
+ # Example: `name asc,update_time, create_time desc`
3002
+ #
3003
+ # Supported fields are:
3004
+ #
3005
+ # - `last_run_time`: corresponds to the last time the DiscoveryConfig ran.
3006
+ # - `name`: corresponds to the DiscoveryConfig's name.
3007
+ # - `status`: corresponds to DiscoveryConfig's status.
3008
+ #
3009
+ # @yield [response, operation] Access the result along with the RPC operation
3010
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dlp::V2::DiscoveryConfig>]
3011
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3012
+ #
3013
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dlp::V2::DiscoveryConfig>]
3014
+ #
3015
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3016
+ #
3017
+ # @example Basic example
3018
+ # require "google/cloud/dlp/v2"
3019
+ #
3020
+ # # Create a client object. The client can be reused for multiple calls.
3021
+ # client = Google::Cloud::Dlp::V2::DlpService::Client.new
3022
+ #
3023
+ # # Create a request. To set request fields, pass in keyword arguments.
3024
+ # request = Google::Cloud::Dlp::V2::ListDiscoveryConfigsRequest.new
3025
+ #
3026
+ # # Call the list_discovery_configs method.
3027
+ # result = client.list_discovery_configs request
3028
+ #
3029
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3030
+ # # over elements, and API calls will be issued to fetch pages as needed.
3031
+ # result.each do |item|
3032
+ # # Each element is of type ::Google::Cloud::Dlp::V2::DiscoveryConfig.
3033
+ # p item
3034
+ # end
3035
+ #
3036
+ def list_discovery_configs request, options = nil
3037
+ raise ::ArgumentError, "request must be provided" if request.nil?
3038
+
3039
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dlp::V2::ListDiscoveryConfigsRequest
3040
+
3041
+ # Converts hash and nil to an options object
3042
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3043
+
3044
+ # Customize the options with defaults
3045
+ metadata = @config.rpcs.list_discovery_configs.metadata.to_h
3046
+
3047
+ # Set x-goog-api-client and x-goog-user-project headers
3048
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3049
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3050
+ gapic_version: ::Google::Cloud::Dlp::V2::VERSION
3051
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3052
+
3053
+ header_params = {}
3054
+ if request.parent
3055
+ header_params["parent"] = request.parent
3056
+ end
3057
+
3058
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3059
+ metadata[:"x-goog-request-params"] ||= request_params_header
3060
+
3061
+ options.apply_defaults timeout: @config.rpcs.list_discovery_configs.timeout,
3062
+ metadata: metadata,
3063
+ retry_policy: @config.rpcs.list_discovery_configs.retry_policy
3064
+
3065
+ options.apply_defaults timeout: @config.timeout,
3066
+ metadata: @config.metadata,
3067
+ retry_policy: @config.retry_policy
3068
+
3069
+ @dlp_service_stub.call_rpc :list_discovery_configs, request, options: options do |response, operation|
3070
+ response = ::Gapic::PagedEnumerable.new @dlp_service_stub, :list_discovery_configs, request, response, operation, options
3071
+ yield response, operation if block_given?
3072
+ return response
3073
+ end
3074
+ rescue ::GRPC::BadStatus => e
3075
+ raise ::Google::Cloud::Error.from_error(e)
3076
+ end
3077
+
3078
+ ##
3079
+ # Deletes a discovery configuration.
3080
+ #
3081
+ # @overload delete_discovery_config(request, options = nil)
3082
+ # Pass arguments to `delete_discovery_config` via a request object, either of type
3083
+ # {::Google::Cloud::Dlp::V2::DeleteDiscoveryConfigRequest} or an equivalent Hash.
3084
+ #
3085
+ # @param request [::Google::Cloud::Dlp::V2::DeleteDiscoveryConfigRequest, ::Hash]
3086
+ # A request object representing the call parameters. Required. To specify no
3087
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3088
+ # @param options [::Gapic::CallOptions, ::Hash]
3089
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3090
+ #
3091
+ # @overload delete_discovery_config(name: nil)
3092
+ # Pass arguments to `delete_discovery_config` via keyword arguments. Note that at
3093
+ # least one keyword argument is required. To specify no parameters, or to keep all
3094
+ # the default parameter values, pass an empty Hash as a request object (see above).
3095
+ #
3096
+ # @param name [::String]
3097
+ # Required. Resource name of the project and the config, for example
3098
+ # `projects/dlp-test-project/discoveryConfigs/53234423`.
3099
+ #
3100
+ # @yield [response, operation] Access the result along with the RPC operation
3101
+ # @yieldparam response [::Google::Protobuf::Empty]
3102
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3103
+ #
3104
+ # @return [::Google::Protobuf::Empty]
3105
+ #
3106
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3107
+ #
3108
+ # @example Basic example
3109
+ # require "google/cloud/dlp/v2"
3110
+ #
3111
+ # # Create a client object. The client can be reused for multiple calls.
3112
+ # client = Google::Cloud::Dlp::V2::DlpService::Client.new
3113
+ #
3114
+ # # Create a request. To set request fields, pass in keyword arguments.
3115
+ # request = Google::Cloud::Dlp::V2::DeleteDiscoveryConfigRequest.new
3116
+ #
3117
+ # # Call the delete_discovery_config method.
3118
+ # result = client.delete_discovery_config request
3119
+ #
3120
+ # # The returned object is of type Google::Protobuf::Empty.
3121
+ # p result
3122
+ #
3123
+ def delete_discovery_config request, options = nil
3124
+ raise ::ArgumentError, "request must be provided" if request.nil?
3125
+
3126
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dlp::V2::DeleteDiscoveryConfigRequest
3127
+
3128
+ # Converts hash and nil to an options object
3129
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3130
+
3131
+ # Customize the options with defaults
3132
+ metadata = @config.rpcs.delete_discovery_config.metadata.to_h
3133
+
3134
+ # Set x-goog-api-client and x-goog-user-project headers
3135
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3136
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3137
+ gapic_version: ::Google::Cloud::Dlp::V2::VERSION
3138
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3139
+
3140
+ header_params = {}
3141
+ if request.name
3142
+ header_params["name"] = request.name
3143
+ end
3144
+
3145
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3146
+ metadata[:"x-goog-request-params"] ||= request_params_header
3147
+
3148
+ options.apply_defaults timeout: @config.rpcs.delete_discovery_config.timeout,
3149
+ metadata: metadata,
3150
+ retry_policy: @config.rpcs.delete_discovery_config.retry_policy
3151
+
3152
+ options.apply_defaults timeout: @config.timeout,
3153
+ metadata: @config.metadata,
3154
+ retry_policy: @config.retry_policy
3155
+
3156
+ @dlp_service_stub.call_rpc :delete_discovery_config, request, options: options do |response, operation|
3157
+ yield response, operation if block_given?
3158
+ return response
3159
+ end
3160
+ rescue ::GRPC::BadStatus => e
3161
+ raise ::Google::Cloud::Error.from_error(e)
3162
+ end
3163
+
2646
3164
  ##
2647
3165
  # Creates a new job to inspect storage or calculate risk metrics.
2648
3166
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
@@ -2835,8 +3353,8 @@ module Google
2835
3353
  # The type of job. Defaults to `DlpJobType.INSPECT`
2836
3354
  # @param order_by [::String]
2837
3355
  # Comma separated list of fields to order by,
2838
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
2839
- # default sorting order is ascending, redundant space characters are
3356
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
3357
+ # default sorting order is ascending. Redundant space characters are
2840
3358
  # insignificant.
2841
3359
  #
2842
3360
  # Example: `name asc, end_time asc, create_time desc`
@@ -3321,8 +3839,8 @@ module Google
3321
3839
  # the default parameter values, pass an empty Hash as a request object (see above).
3322
3840
  #
3323
3841
  # @param name [::String]
3324
- # Required. Resource name of organization and storedInfoType to be updated, for
3325
- # example `organizations/433245324/storedInfoTypes/432452342` or
3842
+ # Required. Resource name of organization and storedInfoType to be updated,
3843
+ # for example `organizations/433245324/storedInfoTypes/432452342` or
3326
3844
  # projects/project-id/storedInfoTypes/432452342.
3327
3845
  # @param config [::Google::Cloud::Dlp::V2::StoredInfoTypeConfig, ::Hash]
3328
3846
  # Updated configuration for the storedInfoType. If not provided, a new
@@ -3416,8 +3934,8 @@ module Google
3416
3934
  # the default parameter values, pass an empty Hash as a request object (see above).
3417
3935
  #
3418
3936
  # @param name [::String]
3419
- # Required. Resource name of the organization and storedInfoType to be read, for
3420
- # example `organizations/433245324/storedInfoTypes/432452342` or
3937
+ # Required. Resource name of the organization and storedInfoType to be read,
3938
+ # for example `organizations/433245324/storedInfoTypes/432452342` or
3421
3939
  # projects/project-id/storedInfoTypes/432452342.
3422
3940
  #
3423
3941
  # @yield [response, operation] Access the result along with the RPC operation
@@ -3522,15 +4040,15 @@ module Google
3522
4040
  #
3523
4041
  # parent=projects/example-project/locations/europe-west3
3524
4042
  # @param page_token [::String]
3525
- # Page token to continue retrieval. Comes from previous call
4043
+ # Page token to continue retrieval. Comes from the previous call
3526
4044
  # to `ListStoredInfoTypes`.
3527
4045
  # @param page_size [::Integer]
3528
- # Size of the page, can be limited by the server. If zero server returns
3529
- # a page of max size 100.
4046
+ # Size of the page. This value can be limited by the server. If zero server
4047
+ # returns a page of max size 100.
3530
4048
  # @param order_by [::String]
3531
4049
  # Comma separated list of fields to order by,
3532
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
3533
- # default sorting order is ascending, redundant space characters are
4050
+ # followed by `asc` or `desc` postfix. This list is case insensitive. The
4051
+ # default sorting order is ascending. Redundant space characters are
3534
4052
  # insignificant.
3535
4053
  #
3536
4054
  # Example: `name asc, display_name, create_time desc`
@@ -3635,8 +4153,8 @@ module Google
3635
4153
  # the default parameter values, pass an empty Hash as a request object (see above).
3636
4154
  #
3637
4155
  # @param name [::String]
3638
- # Required. Resource name of the organization and storedInfoType to be deleted, for
3639
- # example `organizations/433245324/storedInfoTypes/432452342` or
4156
+ # Required. Resource name of the organization and storedInfoType to be
4157
+ # deleted, for example `organizations/433245324/storedInfoTypes/432452342` or
3640
4158
  # projects/project-id/storedInfoTypes/432452342.
3641
4159
  #
3642
4160
  # @yield [response, operation] Access the result along with the RPC operation
@@ -3724,8 +4242,8 @@ module Google
3724
4242
  # the default parameter values, pass an empty Hash as a request object (see above).
3725
4243
  #
3726
4244
  # @param name [::String]
3727
- # Required. Resource name of the job to execute a hybrid inspect on, for example
3728
- # `projects/dlp-test-project/dlpJob/53234423`.
4245
+ # Required. Resource name of the job to execute a hybrid inspect on, for
4246
+ # example `projects/dlp-test-project/dlpJob/53234423`.
3729
4247
  # @param hybrid_item [::Google::Cloud::Dlp::V2::HybridContentItem, ::Hash]
3730
4248
  # The item to inspect.
3731
4249
  #
@@ -3909,9 +4427,9 @@ module Google
3909
4427
  # end
3910
4428
  #
3911
4429
  # @!attribute [rw] endpoint
3912
- # The hostname or hostname:port of the service endpoint.
3913
- # Defaults to `"dlp.googleapis.com"`.
3914
- # @return [::String]
4430
+ # A custom service endpoint, as a hostname or hostname:port. The default is
4431
+ # nil, indicating to use the default endpoint in the current universe domain.
4432
+ # @return [::String,nil]
3915
4433
  # @!attribute [rw] credentials
3916
4434
  # Credentials to send with calls. You may provide any of the following types:
3917
4435
  # * (`String`) The path to a service account key file in JSON format
@@ -3957,13 +4475,20 @@ module Google
3957
4475
  # @!attribute [rw] quota_project
3958
4476
  # A separate project against which to charge quota.
3959
4477
  # @return [::String]
4478
+ # @!attribute [rw] universe_domain
4479
+ # The universe domain within which to make requests. This determines the
4480
+ # default endpoint URL. The default value of nil uses the environment
4481
+ # universe (usually the default "googleapis.com" universe).
4482
+ # @return [::String,nil]
3960
4483
  #
3961
4484
  class Configuration
3962
4485
  extend ::Gapic::Config
3963
4486
 
4487
+ # @private
4488
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3964
4489
  DEFAULT_ENDPOINT = "dlp.googleapis.com"
3965
4490
 
3966
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
4491
+ config_attr :endpoint, nil, ::String, nil
3967
4492
  config_attr :credentials, nil do |value|
3968
4493
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3969
4494
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -3978,6 +4503,7 @@ module Google
3978
4503
  config_attr :metadata, nil, ::Hash, nil
3979
4504
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3980
4505
  config_attr :quota_project, nil, ::String, nil
4506
+ config_attr :universe_domain, nil, ::String, nil
3981
4507
 
3982
4508
  # @private
3983
4509
  def initialize parent_config = nil
@@ -4135,6 +4661,31 @@ module Google
4135
4661
  #
4136
4662
  attr_reader :activate_job_trigger
4137
4663
  ##
4664
+ # RPC-specific configuration for `create_discovery_config`
4665
+ # @return [::Gapic::Config::Method]
4666
+ #
4667
+ attr_reader :create_discovery_config
4668
+ ##
4669
+ # RPC-specific configuration for `update_discovery_config`
4670
+ # @return [::Gapic::Config::Method]
4671
+ #
4672
+ attr_reader :update_discovery_config
4673
+ ##
4674
+ # RPC-specific configuration for `get_discovery_config`
4675
+ # @return [::Gapic::Config::Method]
4676
+ #
4677
+ attr_reader :get_discovery_config
4678
+ ##
4679
+ # RPC-specific configuration for `list_discovery_configs`
4680
+ # @return [::Gapic::Config::Method]
4681
+ #
4682
+ attr_reader :list_discovery_configs
4683
+ ##
4684
+ # RPC-specific configuration for `delete_discovery_config`
4685
+ # @return [::Gapic::Config::Method]
4686
+ #
4687
+ attr_reader :delete_discovery_config
4688
+ ##
4138
4689
  # RPC-specific configuration for `create_dlp_job`
4139
4690
  # @return [::Gapic::Config::Method]
4140
4691
  #
@@ -4241,6 +4792,16 @@ module Google
4241
4792
  @delete_job_trigger = ::Gapic::Config::Method.new delete_job_trigger_config
4242
4793
  activate_job_trigger_config = parent_rpcs.activate_job_trigger if parent_rpcs.respond_to? :activate_job_trigger
4243
4794
  @activate_job_trigger = ::Gapic::Config::Method.new activate_job_trigger_config
4795
+ create_discovery_config_config = parent_rpcs.create_discovery_config if parent_rpcs.respond_to? :create_discovery_config
4796
+ @create_discovery_config = ::Gapic::Config::Method.new create_discovery_config_config
4797
+ update_discovery_config_config = parent_rpcs.update_discovery_config if parent_rpcs.respond_to? :update_discovery_config
4798
+ @update_discovery_config = ::Gapic::Config::Method.new update_discovery_config_config
4799
+ get_discovery_config_config = parent_rpcs.get_discovery_config if parent_rpcs.respond_to? :get_discovery_config
4800
+ @get_discovery_config = ::Gapic::Config::Method.new get_discovery_config_config
4801
+ list_discovery_configs_config = parent_rpcs.list_discovery_configs if parent_rpcs.respond_to? :list_discovery_configs
4802
+ @list_discovery_configs = ::Gapic::Config::Method.new list_discovery_configs_config
4803
+ delete_discovery_config_config = parent_rpcs.delete_discovery_config if parent_rpcs.respond_to? :delete_discovery_config
4804
+ @delete_discovery_config = ::Gapic::Config::Method.new delete_discovery_config_config
4244
4805
  create_dlp_job_config = parent_rpcs.create_dlp_job if parent_rpcs.respond_to? :create_dlp_job
4245
4806
  @create_dlp_job = ::Gapic::Config::Method.new create_dlp_job_config
4246
4807
  list_dlp_jobs_config = parent_rpcs.list_dlp_jobs if parent_rpcs.respond_to? :list_dlp_jobs