google-cloud-security_center-v1 0.3.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,3 +33,6 @@ module Google
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/security_center/v1/_helpers" if ::File.file? helper_path
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -76,81 +76,81 @@ module Google
76
76
  default_config.rpcs.get_iam_policy.timeout = 60.0
77
77
  default_config.rpcs.get_iam_policy.retry_policy = {
78
78
  initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [4, 14]
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: [4, 14]
82
82
  }
83
83
 
84
84
  default_config.rpcs.get_notification_config.timeout = 60.0
85
85
  default_config.rpcs.get_notification_config.retry_policy = {
86
86
  initial_delay: 0.1,
87
- max_delay: 60.0,
88
- multiplier: 1.3,
89
- retry_codes: [4, 14]
87
+ max_delay: 60.0,
88
+ multiplier: 1.3,
89
+ retry_codes: [4, 14]
90
90
  }
91
91
 
92
92
  default_config.rpcs.get_organization_settings.timeout = 60.0
93
93
  default_config.rpcs.get_organization_settings.retry_policy = {
94
94
  initial_delay: 0.1,
95
- max_delay: 60.0,
96
- multiplier: 1.3,
97
- retry_codes: [4, 14]
95
+ max_delay: 60.0,
96
+ multiplier: 1.3,
97
+ retry_codes: [4, 14]
98
98
  }
99
99
 
100
100
  default_config.rpcs.get_source.timeout = 60.0
101
101
  default_config.rpcs.get_source.retry_policy = {
102
102
  initial_delay: 0.1,
103
- max_delay: 60.0,
104
- multiplier: 1.3,
105
- retry_codes: [4, 14]
103
+ max_delay: 60.0,
104
+ multiplier: 1.3,
105
+ retry_codes: [4, 14]
106
106
  }
107
107
 
108
108
  default_config.rpcs.group_assets.timeout = 480.0
109
109
  default_config.rpcs.group_assets.retry_policy = {
110
110
  initial_delay: 0.1,
111
- max_delay: 60.0,
112
- multiplier: 1.3,
113
- retry_codes: [4, 14]
111
+ max_delay: 60.0,
112
+ multiplier: 1.3,
113
+ retry_codes: [4, 14]
114
114
  }
115
115
 
116
116
  default_config.rpcs.group_findings.timeout = 480.0
117
117
  default_config.rpcs.group_findings.retry_policy = {
118
118
  initial_delay: 0.1,
119
- max_delay: 60.0,
120
- multiplier: 1.3,
121
- retry_codes: [4, 14]
119
+ max_delay: 60.0,
120
+ multiplier: 1.3,
121
+ retry_codes: [4, 14]
122
122
  }
123
123
 
124
124
  default_config.rpcs.list_assets.timeout = 480.0
125
125
  default_config.rpcs.list_assets.retry_policy = {
126
126
  initial_delay: 0.1,
127
- max_delay: 60.0,
128
- multiplier: 1.3,
129
- retry_codes: [4, 14]
127
+ max_delay: 60.0,
128
+ multiplier: 1.3,
129
+ retry_codes: [4, 14]
130
130
  }
131
131
 
132
132
  default_config.rpcs.list_findings.timeout = 480.0
133
133
  default_config.rpcs.list_findings.retry_policy = {
134
134
  initial_delay: 0.1,
135
- max_delay: 60.0,
136
- multiplier: 1.3,
137
- retry_codes: [4, 14]
135
+ max_delay: 60.0,
136
+ multiplier: 1.3,
137
+ retry_codes: [4, 14]
138
138
  }
139
139
 
140
140
  default_config.rpcs.list_notification_configs.timeout = 60.0
141
141
  default_config.rpcs.list_notification_configs.retry_policy = {
142
142
  initial_delay: 0.1,
143
- max_delay: 60.0,
144
- multiplier: 1.3,
145
- retry_codes: [4, 14]
143
+ max_delay: 60.0,
144
+ multiplier: 1.3,
145
+ retry_codes: [4, 14]
146
146
  }
147
147
 
148
148
  default_config.rpcs.list_sources.timeout = 60.0
149
149
  default_config.rpcs.list_sources.retry_policy = {
150
150
  initial_delay: 0.1,
151
- max_delay: 60.0,
152
- multiplier: 1.3,
153
- retry_codes: [4, 14]
151
+ max_delay: 60.0,
152
+ multiplier: 1.3,
153
+ retry_codes: [4, 14]
154
154
  }
155
155
 
156
156
  default_config.rpcs.run_asset_discovery.timeout = 60.0
@@ -162,9 +162,9 @@ module Google
162
162
  default_config.rpcs.test_iam_permissions.timeout = 60.0
163
163
  default_config.rpcs.test_iam_permissions.retry_policy = {
164
164
  initial_delay: 0.1,
165
- max_delay: 60.0,
166
- multiplier: 1.3,
167
- retry_codes: [4, 14]
165
+ max_delay: 60.0,
166
+ multiplier: 1.3,
167
+ retry_codes: [4, 14]
168
168
  }
169
169
 
170
170
  default_config.rpcs.update_finding.timeout = 60.0
@@ -238,7 +238,13 @@ module Google
238
238
 
239
239
  # Create credentials
240
240
  credentials = @config.credentials
241
- credentials ||= Credentials.default scope: @config.scope
241
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
242
+ # but only if the default endpoint does not have a region prefix.
243
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
244
+ @config.endpoint == Client.configure.endpoint &&
245
+ !@config.endpoint.split(".").first.include?("-")
246
+ credentials ||= Credentials.default scope: @config.scope,
247
+ enable_self_signed_jwt: enable_self_signed_jwt
242
248
  if credentials.is_a?(String) || credentials.is_a?(Hash)
243
249
  credentials = Credentials.new credentials, scope: @config.scope
244
250
  end
@@ -290,8 +296,8 @@ module Google
290
296
  # Required. Resource name of the new source's parent. Its format should be
291
297
  # "organizations/[organization_id]".
292
298
  # @param source [::Google::Cloud::SecurityCenter::V1::Source, ::Hash]
293
- # Required. The Source being created, only the display_name and description
294
- # will be used. All other fields will be ignored.
299
+ # Required. The Source being created, only the display_name and description will be
300
+ # used. All other fields will be ignored.
295
301
  #
296
302
  # @yield [response, operation] Access the result along with the RPC operation
297
303
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::Source]
@@ -365,8 +371,8 @@ module Google
365
371
  # It must be alphanumeric and less than or equal to 32 characters and
366
372
  # greater than 0 characters in length.
367
373
  # @param finding [::Google::Cloud::SecurityCenter::V1::Finding, ::Hash]
368
- # Required. The Finding being created. The name and security_marks will be
369
- # ignored as they are both output only fields on this resource.
374
+ # Required. The Finding being created. The name and security_marks will be ignored as
375
+ # they are both output only fields on this resource.
370
376
  #
371
377
  # @yield [response, operation] Access the result along with the RPC operation
372
378
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::Finding]
@@ -432,17 +438,16 @@ module Google
432
438
  # the default parameter values, pass an empty Hash as a request object (see above).
433
439
  #
434
440
  # @param parent [::String]
435
- # Required. Resource name of the new notification config's parent. Its format
436
- # is "organizations/[organization_id]".
441
+ # Required. Resource name of the new notification config's parent. Its format is
442
+ # "organizations/[organization_id]".
437
443
  # @param config_id [::String]
438
444
  # Required.
439
445
  # Unique identifier provided by the client within the parent scope.
440
446
  # It must be between 1 and 128 characters, and contains alphanumeric
441
447
  # characters, underscores or hyphens only.
442
448
  # @param notification_config [::Google::Cloud::SecurityCenter::V1::NotificationConfig, ::Hash]
443
- # Required. The notification config being created. The name and the service
444
- # account will be ignored as they are both output only fields on this
445
- # resource.
449
+ # Required. The notification config being created. The name and the service account
450
+ # will be ignored as they are both output only fields on this resource.
446
451
  #
447
452
  # @yield [response, operation] Access the result along with the RPC operation
448
453
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::NotificationConfig]
@@ -712,8 +717,8 @@ module Google
712
717
  # the default parameter values, pass an empty Hash as a request object (see above).
713
718
  #
714
719
  # @param name [::String]
715
- # Required. Name of the organization to get organization settings for. Its
716
- # format is "organizations/[organization_id]/organizationSettings".
720
+ # Required. Name of the organization to get organization settings for. Its format is
721
+ # "organizations/[organization_id]/organizationSettings".
717
722
  #
718
723
  # @yield [response, operation] Access the result along with the RPC operation
719
724
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::OrganizationSettings]
@@ -908,14 +913,14 @@ module Google
908
913
  # For example, `resource_properties.size = 100` is a valid filter string.
909
914
  #
910
915
  # Use a partial match on the empty string to filter based on a property
911
- # existing:`resource_properties.my_property : ""`
916
+ # existing: `resource_properties.my_property : ""`
912
917
  #
913
918
  # Use a negated partial match on the empty string to filter based on a
914
919
  # property not existing: `-resource_properties.my_property : ""`
915
920
  # @param group_by [::String]
916
- # Required. Expression that defines what assets fields to use for grouping.
917
- # The string value should follow SQL syntax: comma separated list of fields.
918
- # For example:
921
+ # Required. Expression that defines what assets fields to use for grouping. The string
922
+ # value should follow SQL syntax: comma separated list of fields. For
923
+ # example:
919
924
  # "security_center_properties.resource_project,security_center_properties.project".
920
925
  #
921
926
  # The following fields are supported when compare_duration is not set:
@@ -1079,6 +1084,7 @@ module Google
1079
1084
  # * category: `=`, `:`
1080
1085
  # * external_uri: `=`, `:`
1081
1086
  # * event_time: `=`, `>`, `<`, `>=`, `<=`
1087
+ # * severity: `=`, `:`
1082
1088
  #
1083
1089
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
1084
1090
  # Examples:
@@ -1096,9 +1102,9 @@ module Google
1096
1102
  # Use a negated partial match on the empty string to filter based on a
1097
1103
  # property not existing: `-source_properties.my_property : ""`
1098
1104
  # @param group_by [::String]
1099
- # Required. Expression that defines what assets fields to use for grouping
1100
- # (including `state_change`). The string value should follow SQL syntax:
1101
- # comma separated list of fields. For example: "parent,resource_name".
1105
+ # Required. Expression that defines what assets fields to use for grouping (including
1106
+ # `state_change`). The string value should follow SQL syntax: comma separated
1107
+ # list of fields. For example: "parent,resource_name".
1102
1108
  #
1103
1109
  # The following fields are supported:
1104
1110
  #
@@ -1106,6 +1112,7 @@ module Google
1106
1112
  # * category
1107
1113
  # * state
1108
1114
  # * parent
1115
+ # * severity
1109
1116
  #
1110
1117
  # The following fields are supported when compare_duration is set:
1111
1118
  #
@@ -1339,8 +1346,9 @@ module Google
1339
1346
  # is "UNUSED", which will be the state_change set for all assets present at
1340
1347
  # read_time.
1341
1348
  # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
1342
- # Optional. A field mask to specify the ListAssetsResult fields to be listed
1343
- # in the response. An empty field mask will list all fields.
1349
+ # A field mask to specify the ListAssetsResult fields to be listed in the
1350
+ # response.
1351
+ # An empty field mask will list all fields.
1344
1352
  # @param page_token [::String]
1345
1353
  # The value returned by the last `ListAssetsResponse`; indicates
1346
1354
  # that this is a continuation of a prior `ListAssets` call, and
@@ -1448,13 +1456,14 @@ module Google
1448
1456
  #
1449
1457
  # The following field and operator combinations are supported:
1450
1458
  #
1451
- # name: `=`
1452
- # parent: `=`, `:`
1453
- # resource_name: `=`, `:`
1454
- # state: `=`, `:`
1455
- # category: `=`, `:`
1456
- # external_uri: `=`, `:`
1457
- # event_time: `=`, `>`, `<`, `>=`, `<=`
1459
+ # * name: `=`
1460
+ # * parent: `=`, `:`
1461
+ # * resource_name: `=`, `:`
1462
+ # * state: `=`, `:`
1463
+ # * category: `=`, `:`
1464
+ # * external_uri: `=`, `:`
1465
+ # * event_time: `=`, `>`, `<`, `>=`, `<=`
1466
+ # * severity: `=`, `:`
1458
1467
  #
1459
1468
  # Usage: This should be milliseconds since epoch or an RFC3339 string.
1460
1469
  # Examples:
@@ -1527,8 +1536,8 @@ module Google
1527
1536
  # is "UNUSED", which will be the state_change set for all findings present at
1528
1537
  # read_time.
1529
1538
  # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
1530
- # Optional. A field mask to specify the Finding fields to be listed in the
1531
- # response. An empty field mask will list all fields.
1539
+ # A field mask to specify the Finding fields to be listed in the response.
1540
+ # An empty field mask will list all fields.
1532
1541
  # @param page_token [::String]
1533
1542
  # The value returned by the last `ListFindingsResponse`; indicates
1534
1543
  # that this is a continuation of a prior `ListFindings` call, and
@@ -1757,8 +1766,8 @@ module Google
1757
1766
  # the default parameter values, pass an empty Hash as a request object (see above).
1758
1767
  #
1759
1768
  # @param parent [::String]
1760
- # Required. Name of the organization to run asset discovery for. Its format
1761
- # is "organizations/[organization_id]".
1769
+ # Required. Name of the organization to run asset discovery for. Its format is
1770
+ # "organizations/[organization_id]".
1762
1771
  #
1763
1772
  # @yield [response, operation] Access the result along with the RPC operation
1764
1773
  # @yieldparam response [::Gapic::Operation]
@@ -2043,8 +2052,8 @@ module Google
2043
2052
  # the default parameter values, pass an empty Hash as a request object (see above).
2044
2053
  #
2045
2054
  # @param finding [::Google::Cloud::SecurityCenter::V1::Finding, ::Hash]
2046
- # Required. The finding resource to update or create if it does not already
2047
- # exist. parent, security_marks, and update_time will be ignored.
2055
+ # Required. The finding resource to update or create if it does not already exist.
2056
+ # parent, security_marks, and update_time will be ignored.
2048
2057
  #
2049
2058
  # In the case of creation, the finding id portion of the name must be
2050
2059
  # alphanumeric and less than or equal to 32 characters and greater than 0
@@ -2197,7 +2206,7 @@ module Google
2197
2206
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2198
2207
  # The FieldMask to use when updating the settings resource.
2199
2208
  #
2200
- # If empty all mutable fields will be updated.
2209
+ # If empty all mutable fields will be updated.
2201
2210
  #
2202
2211
  # @yield [response, operation] Access the result along with the RPC operation
2203
2212
  # @yieldparam response [::Google::Cloud::SecurityCenter::V1::OrganizationSettings]
@@ -2482,7 +2491,7 @@ module Google
2482
2491
  config_attr :scope, nil, ::String, ::Array, nil
2483
2492
  config_attr :lib_name, nil, ::String, nil
2484
2493
  config_attr :lib_version, nil, ::String, nil
2485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
2494
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2486
2495
  config_attr :interceptors, nil, ::Array, nil
2487
2496
  config_attr :timeout, nil, ::Numeric, nil
2488
2497
  config_attr :metadata, nil, ::Hash, nil
@@ -2503,7 +2512,7 @@ module Google
2503
2512
  def rpcs
2504
2513
  @rpcs ||= begin
2505
2514
  parent_rpcs = nil
2506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
2515
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2507
2516
  Rpcs.new parent_rpcs
2508
2517
  end
2509
2518
  end
@@ -2515,7 +2524,7 @@ module Google
2515
2524
  # Each configuration object is of type `Gapic::Config::Method` and includes
2516
2525
  # the following configuration fields:
2517
2526
  #
2518
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2527
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2519
2528
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2520
2529
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2521
2530
  # include the following keys:
@@ -2644,51 +2653,51 @@ module Google
2644
2653
 
2645
2654
  # @private
2646
2655
  def initialize parent_rpcs = nil
2647
- create_source_config = parent_rpcs&.create_source if parent_rpcs&.respond_to? :create_source
2656
+ create_source_config = parent_rpcs.create_source if parent_rpcs.respond_to? :create_source
2648
2657
  @create_source = ::Gapic::Config::Method.new create_source_config
2649
- create_finding_config = parent_rpcs&.create_finding if parent_rpcs&.respond_to? :create_finding
2658
+ create_finding_config = parent_rpcs.create_finding if parent_rpcs.respond_to? :create_finding
2650
2659
  @create_finding = ::Gapic::Config::Method.new create_finding_config
2651
- create_notification_config_config = parent_rpcs&.create_notification_config if parent_rpcs&.respond_to? :create_notification_config
2660
+ create_notification_config_config = parent_rpcs.create_notification_config if parent_rpcs.respond_to? :create_notification_config
2652
2661
  @create_notification_config = ::Gapic::Config::Method.new create_notification_config_config
2653
- delete_notification_config_config = parent_rpcs&.delete_notification_config if parent_rpcs&.respond_to? :delete_notification_config
2662
+ delete_notification_config_config = parent_rpcs.delete_notification_config if parent_rpcs.respond_to? :delete_notification_config
2654
2663
  @delete_notification_config = ::Gapic::Config::Method.new delete_notification_config_config
2655
- get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
2664
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
2656
2665
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
2657
- get_notification_config_config = parent_rpcs&.get_notification_config if parent_rpcs&.respond_to? :get_notification_config
2666
+ get_notification_config_config = parent_rpcs.get_notification_config if parent_rpcs.respond_to? :get_notification_config
2658
2667
  @get_notification_config = ::Gapic::Config::Method.new get_notification_config_config
2659
- get_organization_settings_config = parent_rpcs&.get_organization_settings if parent_rpcs&.respond_to? :get_organization_settings
2668
+ get_organization_settings_config = parent_rpcs.get_organization_settings if parent_rpcs.respond_to? :get_organization_settings
2660
2669
  @get_organization_settings = ::Gapic::Config::Method.new get_organization_settings_config
2661
- get_source_config = parent_rpcs&.get_source if parent_rpcs&.respond_to? :get_source
2670
+ get_source_config = parent_rpcs.get_source if parent_rpcs.respond_to? :get_source
2662
2671
  @get_source = ::Gapic::Config::Method.new get_source_config
2663
- group_assets_config = parent_rpcs&.group_assets if parent_rpcs&.respond_to? :group_assets
2672
+ group_assets_config = parent_rpcs.group_assets if parent_rpcs.respond_to? :group_assets
2664
2673
  @group_assets = ::Gapic::Config::Method.new group_assets_config
2665
- group_findings_config = parent_rpcs&.group_findings if parent_rpcs&.respond_to? :group_findings
2674
+ group_findings_config = parent_rpcs.group_findings if parent_rpcs.respond_to? :group_findings
2666
2675
  @group_findings = ::Gapic::Config::Method.new group_findings_config
2667
- list_assets_config = parent_rpcs&.list_assets if parent_rpcs&.respond_to? :list_assets
2676
+ list_assets_config = parent_rpcs.list_assets if parent_rpcs.respond_to? :list_assets
2668
2677
  @list_assets = ::Gapic::Config::Method.new list_assets_config
2669
- list_findings_config = parent_rpcs&.list_findings if parent_rpcs&.respond_to? :list_findings
2678
+ list_findings_config = parent_rpcs.list_findings if parent_rpcs.respond_to? :list_findings
2670
2679
  @list_findings = ::Gapic::Config::Method.new list_findings_config
2671
- list_notification_configs_config = parent_rpcs&.list_notification_configs if parent_rpcs&.respond_to? :list_notification_configs
2680
+ list_notification_configs_config = parent_rpcs.list_notification_configs if parent_rpcs.respond_to? :list_notification_configs
2672
2681
  @list_notification_configs = ::Gapic::Config::Method.new list_notification_configs_config
2673
- list_sources_config = parent_rpcs&.list_sources if parent_rpcs&.respond_to? :list_sources
2682
+ list_sources_config = parent_rpcs.list_sources if parent_rpcs.respond_to? :list_sources
2674
2683
  @list_sources = ::Gapic::Config::Method.new list_sources_config
2675
- run_asset_discovery_config = parent_rpcs&.run_asset_discovery if parent_rpcs&.respond_to? :run_asset_discovery
2684
+ run_asset_discovery_config = parent_rpcs.run_asset_discovery if parent_rpcs.respond_to? :run_asset_discovery
2676
2685
  @run_asset_discovery = ::Gapic::Config::Method.new run_asset_discovery_config
2677
- set_finding_state_config = parent_rpcs&.set_finding_state if parent_rpcs&.respond_to? :set_finding_state
2686
+ set_finding_state_config = parent_rpcs.set_finding_state if parent_rpcs.respond_to? :set_finding_state
2678
2687
  @set_finding_state = ::Gapic::Config::Method.new set_finding_state_config
2679
- set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
2688
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
2680
2689
  @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
2681
- test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
2690
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
2682
2691
  @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
2683
- update_finding_config = parent_rpcs&.update_finding if parent_rpcs&.respond_to? :update_finding
2692
+ update_finding_config = parent_rpcs.update_finding if parent_rpcs.respond_to? :update_finding
2684
2693
  @update_finding = ::Gapic::Config::Method.new update_finding_config
2685
- update_notification_config_config = parent_rpcs&.update_notification_config if parent_rpcs&.respond_to? :update_notification_config
2694
+ update_notification_config_config = parent_rpcs.update_notification_config if parent_rpcs.respond_to? :update_notification_config
2686
2695
  @update_notification_config = ::Gapic::Config::Method.new update_notification_config_config
2687
- update_organization_settings_config = parent_rpcs&.update_organization_settings if parent_rpcs&.respond_to? :update_organization_settings
2696
+ update_organization_settings_config = parent_rpcs.update_organization_settings if parent_rpcs.respond_to? :update_organization_settings
2688
2697
  @update_organization_settings = ::Gapic::Config::Method.new update_organization_settings_config
2689
- update_source_config = parent_rpcs&.update_source if parent_rpcs&.respond_to? :update_source
2698
+ update_source_config = parent_rpcs.update_source if parent_rpcs.respond_to? :update_source
2690
2699
  @update_source = ::Gapic::Config::Method.new update_source_config
2691
- update_security_marks_config = parent_rpcs&.update_security_marks if parent_rpcs&.respond_to? :update_security_marks
2700
+ update_security_marks_config = parent_rpcs.update_security_marks if parent_rpcs.respond_to? :update_security_marks
2692
2701
  @update_security_marks = ::Gapic::Config::Method.new update_security_marks_config
2693
2702
 
2694
2703
  yield self if block_given?
@@ -103,8 +103,13 @@ module Google
103
103
  # Lists operations that match the specified filter in the request. If the
104
104
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
105
  #
106
- # NOTE: the `name` binding below allows API services to override the binding
107
- # to use different resource name schemes, such as `users/*/operations`.
106
+ # NOTE: the `name` binding allows API services to override the binding
107
+ # to use different resource name schemes, such as `users/*/operations`. To
108
+ # override the binding, API services can add a binding such as
109
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
110
+ # For backwards compatibility, the default name includes the operations
111
+ # collection id, however overriding users must ensure the name binding
112
+ # is the parent resource, without the operations collection id.
108
113
  #
109
114
  # @overload list_operations(request, options = nil)
110
115
  # Pass arguments to `list_operations` via a request object, either of type
@@ -122,7 +127,7 @@ module Google
122
127
  # the default parameter values, pass an empty Hash as a request object (see above).
123
128
  #
124
129
  # @param name [::String]
125
- # The name of the operation collection.
130
+ # The name of the operation's parent resource.
126
131
  # @param filter [::String]
127
132
  # The standard list filter.
128
133
  # @param page_size [::Integer]
@@ -390,6 +395,79 @@ module Google
390
395
  raise ::Google::Cloud::Error.from_error(e)
391
396
  end
392
397
 
398
+ ##
399
+ # Waits for the specified long-running operation until it is done or reaches
400
+ # at most a specified timeout, returning the latest state. If the operation
401
+ # is already done, the latest state is immediately returned. If the timeout
402
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
+ # timeout is used. If the server does not support this method, it returns
404
+ # `google.rpc.Code.UNIMPLEMENTED`.
405
+ # Note that this method is on a best-effort basis. It may return the latest
406
+ # state before the specified timeout (including immediately), meaning even an
407
+ # immediate response is no guarantee that the operation is done.
408
+ #
409
+ # @overload wait_operation(request, options = nil)
410
+ # Pass arguments to `wait_operation` via a request object, either of type
411
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
414
+ # A request object representing the call parameters. Required. To specify no
415
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
416
+ # @param options [::Gapic::CallOptions, ::Hash]
417
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
418
+ #
419
+ # @overload wait_operation(name: nil, timeout: nil)
420
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
421
+ # least one keyword argument is required. To specify no parameters, or to keep all
422
+ # the default parameter values, pass an empty Hash as a request object (see above).
423
+ #
424
+ # @param name [::String]
425
+ # The name of the operation resource to wait on.
426
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
427
+ # The maximum duration to wait before timing out. If left blank, the wait
428
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
429
+ # If RPC context deadline is also specified, the shorter one will be used.
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Gapic::Operation]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Gapic::Operation]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ def wait_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.wait_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::SecurityCenter::V1::VERSION
454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.wait_operation.retry_policy
459
+ options.apply_defaults metadata: @config.metadata,
460
+ retry_policy: @config.retry_policy
461
+
462
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
463
+ response = ::Gapic::Operation.new response, @operations_client, options: options
464
+ yield response, operation if block_given?
465
+ return response
466
+ end
467
+ rescue ::GRPC::BadStatus => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
393
471
  ##
394
472
  # Configuration class for the Operations API.
395
473
  #
@@ -482,7 +560,7 @@ module Google
482
560
  config_attr :scope, nil, ::String, ::Array, nil
483
561
  config_attr :lib_name, nil, ::String, nil
484
562
  config_attr :lib_version, nil, ::String, nil
485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
563
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
486
564
  config_attr :interceptors, nil, ::Array, nil
487
565
  config_attr :timeout, nil, ::Numeric, nil
488
566
  config_attr :metadata, nil, ::Hash, nil
@@ -503,7 +581,7 @@ module Google
503
581
  def rpcs
504
582
  @rpcs ||= begin
505
583
  parent_rpcs = nil
506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
584
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
507
585
  Rpcs.new parent_rpcs
508
586
  end
509
587
  end
@@ -515,7 +593,7 @@ module Google
515
593
  # Each configuration object is of type `Gapic::Config::Method` and includes
516
594
  # the following configuration fields:
517
595
  #
518
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
596
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
519
597
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
520
598
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
521
599
  # include the following keys:
@@ -546,17 +624,24 @@ module Google
546
624
  # @return [::Gapic::Config::Method]
547
625
  #
548
626
  attr_reader :cancel_operation
627
+ ##
628
+ # RPC-specific configuration for `wait_operation`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :wait_operation
549
632
 
550
633
  # @private
551
634
  def initialize parent_rpcs = nil
552
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
635
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
553
636
  @list_operations = ::Gapic::Config::Method.new list_operations_config
554
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
637
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
555
638
  @get_operation = ::Gapic::Config::Method.new get_operation_config
556
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
639
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
557
640
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
558
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
641
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
559
642
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
643
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
644
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
560
645
 
561
646
  yield self if block_given?
562
647
  end