google-cloud-security_center 0.9.0 → 1.1.2

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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -2
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +327 -0
  6. data/README.md +36 -25
  7. data/lib/{google/cloud/security_center/v1/doc/google/protobuf/empty.rb → google-cloud-security_center.rb} +4 -14
  8. data/lib/google/cloud/security_center.rb +87 -117
  9. data/lib/google/cloud/security_center/version.rb +6 -2
  10. metadata +63 -113
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/security_center/v1.rb +0 -149
  13. data/lib/google/cloud/security_center/v1/asset_pb.rb +0 -41
  14. data/lib/google/cloud/security_center/v1/credentials.rb +0 -41
  15. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/asset.rb +0 -105
  16. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/finding.rb +0 -97
  17. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/notification_config.rb +0 -75
  18. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/organization_settings.rb +0 -72
  19. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/security_marks.rb +0 -45
  20. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/securitycenter_service.rb +0 -912
  21. data/lib/google/cloud/security_center/v1/doc/google/cloud/securitycenter/v1/source.rb +0 -50
  22. data/lib/google/cloud/security_center/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  23. data/lib/google/cloud/security_center/v1/doc/google/iam/v1/options.rb +0 -33
  24. data/lib/google/cloud/security_center/v1/doc/google/iam/v1/policy.rb +0 -151
  25. data/lib/google/cloud/security_center/v1/doc/google/longrunning/operations.rb +0 -51
  26. data/lib/google/cloud/security_center/v1/doc/google/protobuf/any.rb +0 -131
  27. data/lib/google/cloud/security_center/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/security_center/v1/doc/google/protobuf/field_mask.rb +0 -222
  29. data/lib/google/cloud/security_center/v1/doc/google/protobuf/struct.rb +0 -74
  30. data/lib/google/cloud/security_center/v1/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/security_center/v1/doc/google/rpc/status.rb +0 -39
  32. data/lib/google/cloud/security_center/v1/doc/google/type/expr.rb +0 -45
  33. data/lib/google/cloud/security_center/v1/finding_pb.rb +0 -36
  34. data/lib/google/cloud/security_center/v1/helpers.rb +0 -88
  35. data/lib/google/cloud/security_center/v1/notification_config_pb.rb +0 -28
  36. data/lib/google/cloud/security_center/v1/notification_message_pb.rb +0 -20
  37. data/lib/google/cloud/security_center/v1/organization_settings_pb.rb +0 -30
  38. data/lib/google/cloud/security_center/v1/run_asset_discovery_response_pb.rb +0 -25
  39. data/lib/google/cloud/security_center/v1/security_center_client.rb +0 -2118
  40. data/lib/google/cloud/security_center/v1/security_center_client_config.json +0 -141
  41. data/lib/google/cloud/security_center/v1/security_marks_pb.rb +0 -18
  42. data/lib/google/cloud/security_center/v1/securitycenter_service_pb.rb +0 -230
  43. data/lib/google/cloud/security_center/v1/securitycenter_service_services_pb.rb +0 -100
  44. data/lib/google/cloud/security_center/v1/source_pb.rb +0 -19
  45. data/lib/google/cloud/security_center/v1p1beta1.rb +0 -149
  46. data/lib/google/cloud/security_center/v1p1beta1/asset_pb.rb +0 -41
  47. data/lib/google/cloud/security_center/v1p1beta1/credentials.rb +0 -41
  48. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/asset.rb +0 -105
  49. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/finding.rb +0 -96
  50. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/notification_config.rb +0 -87
  51. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/organization_settings.rb +0 -72
  52. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/security_marks.rb +0 -45
  53. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/securitycenter_service.rb +0 -923
  54. data/lib/google/cloud/security_center/v1p1beta1/doc/google/cloud/securitycenter/v1p1beta1/source.rb +0 -49
  55. data/lib/google/cloud/security_center/v1p1beta1/doc/google/iam/v1/iam_policy.rb +0 -64
  56. data/lib/google/cloud/security_center/v1p1beta1/doc/google/iam/v1/options.rb +0 -33
  57. data/lib/google/cloud/security_center/v1p1beta1/doc/google/iam/v1/policy.rb +0 -151
  58. data/lib/google/cloud/security_center/v1p1beta1/doc/google/longrunning/operations.rb +0 -51
  59. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/any.rb +0 -131
  60. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/duration.rb +0 -91
  61. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/empty.rb +0 -29
  62. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/field_mask.rb +0 -222
  63. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/struct.rb +0 -74
  64. data/lib/google/cloud/security_center/v1p1beta1/doc/google/protobuf/timestamp.rb +0 -113
  65. data/lib/google/cloud/security_center/v1p1beta1/doc/google/rpc/status.rb +0 -39
  66. data/lib/google/cloud/security_center/v1p1beta1/doc/google/type/expr.rb +0 -45
  67. data/lib/google/cloud/security_center/v1p1beta1/finding_pb.rb +0 -36
  68. data/lib/google/cloud/security_center/v1p1beta1/helpers.rb +0 -71
  69. data/lib/google/cloud/security_center/v1p1beta1/notification_config_pb.rb +0 -34
  70. data/lib/google/cloud/security_center/v1p1beta1/notification_message_pb.rb +0 -21
  71. data/lib/google/cloud/security_center/v1p1beta1/organization_settings_pb.rb +0 -30
  72. data/lib/google/cloud/security_center/v1p1beta1/run_asset_discovery_response_pb.rb +0 -25
  73. data/lib/google/cloud/security_center/v1p1beta1/security_center_client.rb +0 -2093
  74. data/lib/google/cloud/security_center/v1p1beta1/security_center_client_config.json +0 -141
  75. data/lib/google/cloud/security_center/v1p1beta1/security_marks_pb.rb +0 -18
  76. data/lib/google/cloud/security_center/v1p1beta1/securitycenter_service_pb.rb +0 -234
  77. data/lib/google/cloud/security_center/v1p1beta1/securitycenter_service_services_pb.rb +0 -103
  78. data/lib/google/cloud/security_center/v1p1beta1/source_pb.rb +0 -19
@@ -1,39 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Rpc
18
- # The `Status` type defines a logical error model that is suitable for
19
- # different programming environments, including REST APIs and RPC APIs. It is
20
- # used by [gRPC](https://github.com/grpc). Each `Status` message contains
21
- # three pieces of data: error code, error message, and error details.
22
- #
23
- # You can find out more about this error model and how to work with it in the
24
- # [API Design Guide](https://cloud.google.com/apis/design/errors).
25
- # @!attribute [rw] code
26
- # @return [Integer]
27
- # The status code, which should be an enum value of {Google::Rpc::Code}.
28
- # @!attribute [rw] message
29
- # @return [String]
30
- # A developer-facing error message, which should be in English. Any
31
- # user-facing error message should be localized and sent in the
32
- # {Google::Rpc::Status#details} field, or localized by the client.
33
- # @!attribute [rw] details
34
- # @return [Array<Google::Protobuf::Any>]
35
- # A list of messages that carry the error details. There is a common set of
36
- # message types for APIs to use.
37
- class Status; end
38
- end
39
- end
@@ -1,45 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Type
18
- # Represents an expression text. Example:
19
- #
20
- # title: "User account presence"
21
- # description: "Determines whether the request has a user account"
22
- # expression: "size(request.user) > 0"
23
- # @!attribute [rw] expression
24
- # @return [String]
25
- # Textual representation of an expression in
26
- # Common Expression Language syntax.
27
- #
28
- # The application context of the containing message determines which
29
- # well-known feature set of CEL is supported.
30
- # @!attribute [rw] title
31
- # @return [String]
32
- # An optional title for the expression, i.e. a short string describing
33
- # its purpose. This can be used e.g. in UIs which allow to enter the
34
- # expression.
35
- # @!attribute [rw] description
36
- # @return [String]
37
- # An optional description of the expression. This is a longer text which
38
- # describes the expression, e.g. when hovered over it in a UI.
39
- # @!attribute [rw] location
40
- # @return [String]
41
- # An optional string indicating the location of the expression for error
42
- # reporting, e.g. a file name and a position in the file.
43
- class Expr; end
44
- end
45
- end
@@ -1,36 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/security_center/v1/finding.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/field_behavior_pb'
9
- require 'google/api/resource_pb'
10
- require 'google/cloud/security_center/v1/security_marks_pb'
11
- require 'google/protobuf/struct_pb'
12
- require 'google/protobuf/timestamp_pb'
13
- Google::Protobuf::DescriptorPool.generated_pool.build do
14
- add_message "google.cloud.securitycenter.v1.Finding" do
15
- optional :name, :string, 1
16
- optional :parent, :string, 2
17
- optional :resource_name, :string, 3
18
- optional :state, :enum, 4, "google.cloud.securitycenter.v1.Finding.State"
19
- optional :category, :string, 5
20
- optional :external_uri, :string, 6
21
- map :source_properties, :string, :message, 7, "google.protobuf.Value"
22
- optional :security_marks, :message, 8, "google.cloud.securitycenter.v1.SecurityMarks"
23
- optional :event_time, :message, 9, "google.protobuf.Timestamp"
24
- optional :create_time, :message, 10, "google.protobuf.Timestamp"
25
- end
26
- add_enum "google.cloud.securitycenter.v1.Finding.State" do
27
- value :STATE_UNSPECIFIED, 0
28
- value :ACTIVE, 1
29
- value :INACTIVE, 2
30
- end
31
- end
32
-
33
- module Google::Cloud::SecurityCenter::V1
34
- Finding = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.Finding").msgclass
35
- Finding::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.Finding.State").enummodule
36
- end
@@ -1,88 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # # limitations under the License.
14
-
15
- module Google
16
- module Cloud
17
- module SecurityCenter
18
- module V1
19
- class SecurityCenterClient
20
-
21
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.asset_security_marks_path.
22
- # @param organization [String]
23
- # @param asset [String]
24
- # @return [String]
25
- def asset_security_marks_path organization, asset
26
- self.class.asset_security_marks_path organization, asset
27
- end
28
-
29
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.finding_path.
30
- # @param organization [String]
31
- # @param source [String]
32
- # @param finding [String]
33
- # @return [String]
34
- def finding_path organization, source, finding
35
- self.class.finding_path organization, source, finding
36
- end
37
-
38
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.finding_security_marks_path.
39
- # @param organization [String]
40
- # @param source [String]
41
- # @param finding [String]
42
- # @return [String]
43
- def finding_security_marks_path organization, source, finding
44
- self.class.finding_security_marks_path organization, source, finding
45
- end
46
-
47
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.notification_config_path.
48
- # @param organization [String]
49
- # @param notification_config [String]
50
- # @return [String]
51
- def notification_config_path organization, notification_config
52
- self.class.notification_config_path organization, notification_config
53
- end
54
-
55
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path.
56
- # @param organization [String]
57
- # @return [String]
58
- def organization_path organization
59
- self.class.organization_path organization
60
- end
61
-
62
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_settings_path.
63
- # @param organization [String]
64
- # @return [String]
65
- def organization_settings_path organization
66
- self.class.organization_settings_path organization
67
- end
68
-
69
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path.
70
- # @param organization [String]
71
- # @param source [String]
72
- # @return [String]
73
- def source_path organization, source
74
- self.class.source_path organization, source
75
- end
76
-
77
- # Alias for Google::Cloud::SecurityCenter::V1::SecurityCenterClient.topic_path.
78
- # @param project [String]
79
- # @param topic [String]
80
- # @return [String]
81
- def topic_path project, topic
82
- self.class.topic_path project, topic
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,28 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/security_center/v1/notification_config.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/field_behavior_pb'
9
- require 'google/api/resource_pb'
10
- Google::Protobuf::DescriptorPool.generated_pool.build do
11
- add_message "google.cloud.securitycenter.v1.NotificationConfig" do
12
- optional :name, :string, 1
13
- optional :description, :string, 2
14
- optional :pubsub_topic, :string, 3
15
- optional :service_account, :string, 4
16
- oneof :notify_config do
17
- optional :streaming_config, :message, 5, "google.cloud.securitycenter.v1.NotificationConfig.StreamingConfig"
18
- end
19
- end
20
- add_message "google.cloud.securitycenter.v1.NotificationConfig.StreamingConfig" do
21
- optional :filter, :string, 1
22
- end
23
- end
24
-
25
- module Google::Cloud::SecurityCenter::V1
26
- NotificationConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.NotificationConfig").msgclass
27
- NotificationConfig::StreamingConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.NotificationConfig.StreamingConfig").msgclass
28
- end
@@ -1,20 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/security_center/v1/notification_message.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/cloud/security_center/v1/finding_pb'
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_message "google.cloud.securitycenter.v1.NotificationMessage" do
11
- optional :notification_config_name, :string, 1
12
- oneof :event do
13
- optional :finding, :message, 2, "google.cloud.securitycenter.v1.Finding"
14
- end
15
- end
16
- end
17
-
18
- module Google::Cloud::SecurityCenter::V1
19
- NotificationMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.NotificationMessage").msgclass
20
- end
@@ -1,30 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/security_center/v1/organization_settings.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/api/resource_pb'
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_message "google.cloud.securitycenter.v1.OrganizationSettings" do
11
- optional :name, :string, 1
12
- optional :enable_asset_discovery, :bool, 2
13
- optional :asset_discovery_config, :message, 3, "google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig"
14
- end
15
- add_message "google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig" do
16
- repeated :project_ids, :string, 1
17
- optional :inclusion_mode, :enum, 2, "google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode"
18
- end
19
- add_enum "google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode" do
20
- value :INCLUSION_MODE_UNSPECIFIED, 0
21
- value :INCLUDE_ONLY, 1
22
- value :EXCLUDE, 2
23
- end
24
- end
25
-
26
- module Google::Cloud::SecurityCenter::V1
27
- OrganizationSettings = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.OrganizationSettings").msgclass
28
- OrganizationSettings::AssetDiscoveryConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig").msgclass
29
- OrganizationSettings::AssetDiscoveryConfig::InclusionMode = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode").enummodule
30
- end
@@ -1,25 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/security_center/v1/run_asset_discovery_response.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- require 'google/protobuf/duration_pb'
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_message "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse" do
11
- optional :state, :enum, 1, "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.State"
12
- optional :duration, :message, 2, "google.protobuf.Duration"
13
- end
14
- add_enum "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.State" do
15
- value :STATE_UNSPECIFIED, 0
16
- value :COMPLETED, 1
17
- value :SUPERSEDED, 2
18
- value :TERMINATED, 3
19
- end
20
- end
21
-
22
- module Google::Cloud::SecurityCenter::V1
23
- RunAssetDiscoveryResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.RunAssetDiscoveryResponse").msgclass
24
- RunAssetDiscoveryResponse::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.State").enummodule
25
- end
@@ -1,2118 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/cloud/security_center/v1/securitycenter_service.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
- require "google/gax/operation"
28
- require "google/longrunning/operations_client"
29
-
30
- require "google/cloud/security_center/v1/securitycenter_service_pb"
31
- require "google/cloud/security_center/v1/run_asset_discovery_response_pb"
32
- require "google/cloud/security_center/v1/credentials"
33
- require "google/cloud/security_center/version"
34
-
35
- module Google
36
- module Cloud
37
- module SecurityCenter
38
- module V1
39
- # V1 APIs for Security Center service.
40
- #
41
- # @!attribute [r] security_center_stub
42
- # @return [Google::Cloud::SecurityCenter::V1::SecurityCenter::Stub]
43
- class SecurityCenterClient
44
- # @private
45
- attr_reader :security_center_stub
46
-
47
- # The default address of the service.
48
- SERVICE_ADDRESS = "securitycenter.googleapis.com".freeze
49
-
50
- # The default port of the service.
51
- DEFAULT_SERVICE_PORT = 443
52
-
53
- # The default set of gRPC interceptors.
54
- GRPC_INTERCEPTORS = []
55
-
56
- DEFAULT_TIMEOUT = 30
57
-
58
- PAGE_DESCRIPTORS = {
59
- "group_assets" => Google::Gax::PageDescriptor.new(
60
- "page_token",
61
- "next_page_token",
62
- "group_by_results"),
63
- "group_findings" => Google::Gax::PageDescriptor.new(
64
- "page_token",
65
- "next_page_token",
66
- "group_by_results"),
67
- "list_assets" => Google::Gax::PageDescriptor.new(
68
- "page_token",
69
- "next_page_token",
70
- "list_assets_results"),
71
- "list_findings" => Google::Gax::PageDescriptor.new(
72
- "page_token",
73
- "next_page_token",
74
- "list_findings_results"),
75
- "list_notification_configs" => Google::Gax::PageDescriptor.new(
76
- "page_token",
77
- "next_page_token",
78
- "notification_configs"),
79
- "list_sources" => Google::Gax::PageDescriptor.new(
80
- "page_token",
81
- "next_page_token",
82
- "sources")
83
- }.freeze
84
-
85
- private_constant :PAGE_DESCRIPTORS
86
-
87
- # The scopes needed to make gRPC calls to all of the methods defined in
88
- # this service.
89
- ALL_SCOPES = [
90
- "https://www.googleapis.com/auth/cloud-platform"
91
- ].freeze
92
-
93
- class OperationsClient < Google::Longrunning::OperationsClient
94
- self::SERVICE_ADDRESS = SecurityCenterClient::SERVICE_ADDRESS
95
- self::GRPC_INTERCEPTORS = SecurityCenterClient::GRPC_INTERCEPTORS
96
- end
97
-
98
- ASSET_SECURITY_MARKS_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
99
- "organizations/{organization}/assets/{asset}/securityMarks"
100
- )
101
-
102
- private_constant :ASSET_SECURITY_MARKS_PATH_TEMPLATE
103
-
104
- FINDING_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
105
- "organizations/{organization}/sources/{source}/findings/{finding}"
106
- )
107
-
108
- private_constant :FINDING_PATH_TEMPLATE
109
-
110
- FINDING_SECURITY_MARKS_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
111
- "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks"
112
- )
113
-
114
- private_constant :FINDING_SECURITY_MARKS_PATH_TEMPLATE
115
-
116
- NOTIFICATION_CONFIG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
117
- "organizations/{organization}/notificationConfigs/{notification_config}"
118
- )
119
-
120
- private_constant :NOTIFICATION_CONFIG_PATH_TEMPLATE
121
-
122
- ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
123
- "organizations/{organization}"
124
- )
125
-
126
- private_constant :ORGANIZATION_PATH_TEMPLATE
127
-
128
- ORGANIZATION_SETTINGS_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
129
- "organizations/{organization}/organizationSettings"
130
- )
131
-
132
- private_constant :ORGANIZATION_SETTINGS_PATH_TEMPLATE
133
-
134
- SOURCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
135
- "organizations/{organization}/sources/{source}"
136
- )
137
-
138
- private_constant :SOURCE_PATH_TEMPLATE
139
-
140
- TOPIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
141
- "projects/{project}/topics/{topic}"
142
- )
143
-
144
- private_constant :TOPIC_PATH_TEMPLATE
145
-
146
- # Returns a fully-qualified asset_security_marks resource name string.
147
- # @deprecated Multi-pattern resource names will have unified creation and parsing helper functions.
148
- # This helper function will be deleted in the next major version.
149
- # @param organization [String]
150
- # @param asset [String]
151
- # @return [String]
152
- def self.asset_security_marks_path organization, asset
153
- ASSET_SECURITY_MARKS_PATH_TEMPLATE.render(
154
- :"organization" => organization,
155
- :"asset" => asset
156
- )
157
- end
158
-
159
- # Returns a fully-qualified finding resource name string.
160
- # @param organization [String]
161
- # @param source [String]
162
- # @param finding [String]
163
- # @return [String]
164
- def self.finding_path organization, source, finding
165
- FINDING_PATH_TEMPLATE.render(
166
- :"organization" => organization,
167
- :"source" => source,
168
- :"finding" => finding
169
- )
170
- end
171
-
172
- # Returns a fully-qualified finding_security_marks resource name string.
173
- # @deprecated Multi-pattern resource names will have unified creation and parsing helper functions.
174
- # This helper function will be deleted in the next major version.
175
- # @param organization [String]
176
- # @param source [String]
177
- # @param finding [String]
178
- # @return [String]
179
- def self.finding_security_marks_path organization, source, finding
180
- FINDING_SECURITY_MARKS_PATH_TEMPLATE.render(
181
- :"organization" => organization,
182
- :"source" => source,
183
- :"finding" => finding
184
- )
185
- end
186
-
187
- # Returns a fully-qualified notification_config resource name string.
188
- # @param organization [String]
189
- # @param notification_config [String]
190
- # @return [String]
191
- def self.notification_config_path organization, notification_config
192
- NOTIFICATION_CONFIG_PATH_TEMPLATE.render(
193
- :"organization" => organization,
194
- :"notification_config" => notification_config
195
- )
196
- end
197
-
198
- # Returns a fully-qualified organization resource name string.
199
- # @param organization [String]
200
- # @return [String]
201
- def self.organization_path organization
202
- ORGANIZATION_PATH_TEMPLATE.render(
203
- :"organization" => organization
204
- )
205
- end
206
-
207
- # Returns a fully-qualified organization_settings resource name string.
208
- # @param organization [String]
209
- # @return [String]
210
- def self.organization_settings_path organization
211
- ORGANIZATION_SETTINGS_PATH_TEMPLATE.render(
212
- :"organization" => organization
213
- )
214
- end
215
-
216
- # Returns a fully-qualified source resource name string.
217
- # @param organization [String]
218
- # @param source [String]
219
- # @return [String]
220
- def self.source_path organization, source
221
- SOURCE_PATH_TEMPLATE.render(
222
- :"organization" => organization,
223
- :"source" => source
224
- )
225
- end
226
-
227
- # Returns a fully-qualified topic resource name string.
228
- # @param project [String]
229
- # @param topic [String]
230
- # @return [String]
231
- def self.topic_path project, topic
232
- TOPIC_PATH_TEMPLATE.render(
233
- :"project" => project,
234
- :"topic" => topic
235
- )
236
- end
237
-
238
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
239
- # Provides the means for authenticating requests made by the client. This parameter can
240
- # be many types.
241
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
242
- # authenticating requests made by this client.
243
- # A `String` will be treated as the path to the keyfile to be used for the construction of
244
- # credentials for this client.
245
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
246
- # credentials for this client.
247
- # A `GRPC::Core::Channel` will be used to make calls through.
248
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
249
- # should already be composed with a `GRPC::Core::CallCredentials` object.
250
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
251
- # metadata for requests, generally, to give OAuth credentials.
252
- # @param scopes [Array<String>]
253
- # The OAuth scopes for this service. This parameter is ignored if
254
- # an updater_proc is supplied.
255
- # @param client_config [Hash]
256
- # A Hash for call options for each method. See
257
- # Google::Gax#construct_settings for the structure of
258
- # this data. Falls back to the default config if not specified
259
- # or the specified config is missing data points.
260
- # @param timeout [Numeric]
261
- # The default timeout, in seconds, for calls made through this client.
262
- # @param metadata [Hash]
263
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
264
- # @param service_address [String]
265
- # Override for the service hostname, or `nil` to leave as the default.
266
- # @param service_port [Integer]
267
- # Override for the service port, or `nil` to leave as the default.
268
- # @param exception_transformer [Proc]
269
- # An optional proc that intercepts any exceptions raised during an API call to inject
270
- # custom error handling.
271
- def initialize \
272
- credentials: nil,
273
- scopes: ALL_SCOPES,
274
- client_config: {},
275
- timeout: DEFAULT_TIMEOUT,
276
- metadata: nil,
277
- service_address: nil,
278
- service_port: nil,
279
- exception_transformer: nil,
280
- lib_name: nil,
281
- lib_version: ""
282
- # These require statements are intentionally placed here to initialize
283
- # the gRPC module only when it's required.
284
- # See https://github.com/googleapis/toolkit/issues/446
285
- require "google/gax/grpc"
286
- require "google/cloud/security_center/v1/securitycenter_service_services_pb"
287
-
288
- credentials ||= Google::Cloud::SecurityCenter::V1::Credentials.default
289
-
290
- @operations_client = OperationsClient.new(
291
- credentials: credentials,
292
- scopes: scopes,
293
- client_config: client_config,
294
- timeout: timeout,
295
- lib_name: lib_name,
296
- service_address: service_address,
297
- service_port: service_port,
298
- lib_version: lib_version,
299
- metadata: metadata,
300
- )
301
-
302
- if credentials.is_a?(String) || credentials.is_a?(Hash)
303
- updater_proc = Google::Cloud::SecurityCenter::V1::Credentials.new(credentials).updater_proc
304
- end
305
- if credentials.is_a?(GRPC::Core::Channel)
306
- channel = credentials
307
- end
308
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
309
- chan_creds = credentials
310
- end
311
- if credentials.is_a?(Proc)
312
- updater_proc = credentials
313
- end
314
- if credentials.is_a?(Google::Auth::Credentials)
315
- updater_proc = credentials.updater_proc
316
- end
317
-
318
- package_version = Google::Cloud::SecurityCenter::VERSION
319
-
320
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
321
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
322
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
323
- google_api_client << " grpc/#{GRPC::VERSION}"
324
- google_api_client.freeze
325
-
326
- headers = { :"x-goog-api-client" => google_api_client }
327
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
328
- headers[:"x-goog-user-project"] = credentials.quota_project_id
329
- end
330
- headers.merge!(metadata) unless metadata.nil?
331
- client_config_file = Pathname.new(__dir__).join(
332
- "security_center_client_config.json"
333
- )
334
- defaults = client_config_file.open do |f|
335
- Google::Gax.construct_settings(
336
- "google.cloud.securitycenter.v1.SecurityCenter",
337
- JSON.parse(f.read),
338
- client_config,
339
- Google::Gax::Grpc::STATUS_CODE_NAMES,
340
- timeout,
341
- page_descriptors: PAGE_DESCRIPTORS,
342
- errors: Google::Gax::Grpc::API_ERRORS,
343
- metadata: headers
344
- )
345
- end
346
-
347
- # Allow overriding the service path/port in subclasses.
348
- service_path = service_address || self.class::SERVICE_ADDRESS
349
- port = service_port || self.class::DEFAULT_SERVICE_PORT
350
- interceptors = self.class::GRPC_INTERCEPTORS
351
- @security_center_stub = Google::Gax::Grpc.create_stub(
352
- service_path,
353
- port,
354
- chan_creds: chan_creds,
355
- channel: channel,
356
- updater_proc: updater_proc,
357
- scopes: scopes,
358
- interceptors: interceptors,
359
- &Google::Cloud::SecurityCenter::V1::SecurityCenter::Stub.method(:new)
360
- )
361
-
362
- @get_iam_policy = Google::Gax.create_api_call(
363
- @security_center_stub.method(:get_iam_policy),
364
- defaults["get_iam_policy"],
365
- exception_transformer: exception_transformer,
366
- params_extractor: proc do |request|
367
- {'resource' => request.resource}
368
- end
369
- )
370
- @group_assets = Google::Gax.create_api_call(
371
- @security_center_stub.method(:group_assets),
372
- defaults["group_assets"],
373
- exception_transformer: exception_transformer,
374
- params_extractor: proc do |request|
375
- {'parent' => request.parent}
376
- end
377
- )
378
- @group_findings = Google::Gax.create_api_call(
379
- @security_center_stub.method(:group_findings),
380
- defaults["group_findings"],
381
- exception_transformer: exception_transformer,
382
- params_extractor: proc do |request|
383
- {'parent' => request.parent}
384
- end
385
- )
386
- @test_iam_permissions = Google::Gax.create_api_call(
387
- @security_center_stub.method(:test_iam_permissions),
388
- defaults["test_iam_permissions"],
389
- exception_transformer: exception_transformer,
390
- params_extractor: proc do |request|
391
- {'resource' => request.resource}
392
- end
393
- )
394
- @create_source = Google::Gax.create_api_call(
395
- @security_center_stub.method(:create_source),
396
- defaults["create_source"],
397
- exception_transformer: exception_transformer,
398
- params_extractor: proc do |request|
399
- {'parent' => request.parent}
400
- end
401
- )
402
- @create_finding = Google::Gax.create_api_call(
403
- @security_center_stub.method(:create_finding),
404
- defaults["create_finding"],
405
- exception_transformer: exception_transformer,
406
- params_extractor: proc do |request|
407
- {'parent' => request.parent}
408
- end
409
- )
410
- @create_notification_config = Google::Gax.create_api_call(
411
- @security_center_stub.method(:create_notification_config),
412
- defaults["create_notification_config"],
413
- exception_transformer: exception_transformer,
414
- params_extractor: proc do |request|
415
- {'parent' => request.parent}
416
- end
417
- )
418
- @delete_notification_config = Google::Gax.create_api_call(
419
- @security_center_stub.method(:delete_notification_config),
420
- defaults["delete_notification_config"],
421
- exception_transformer: exception_transformer,
422
- params_extractor: proc do |request|
423
- {'name' => request.name}
424
- end
425
- )
426
- @get_notification_config = Google::Gax.create_api_call(
427
- @security_center_stub.method(:get_notification_config),
428
- defaults["get_notification_config"],
429
- exception_transformer: exception_transformer,
430
- params_extractor: proc do |request|
431
- {'name' => request.name}
432
- end
433
- )
434
- @get_organization_settings = Google::Gax.create_api_call(
435
- @security_center_stub.method(:get_organization_settings),
436
- defaults["get_organization_settings"],
437
- exception_transformer: exception_transformer,
438
- params_extractor: proc do |request|
439
- {'name' => request.name}
440
- end
441
- )
442
- @get_source = Google::Gax.create_api_call(
443
- @security_center_stub.method(:get_source),
444
- defaults["get_source"],
445
- exception_transformer: exception_transformer,
446
- params_extractor: proc do |request|
447
- {'name' => request.name}
448
- end
449
- )
450
- @list_assets = Google::Gax.create_api_call(
451
- @security_center_stub.method(:list_assets),
452
- defaults["list_assets"],
453
- exception_transformer: exception_transformer,
454
- params_extractor: proc do |request|
455
- {'parent' => request.parent}
456
- end
457
- )
458
- @list_findings = Google::Gax.create_api_call(
459
- @security_center_stub.method(:list_findings),
460
- defaults["list_findings"],
461
- exception_transformer: exception_transformer,
462
- params_extractor: proc do |request|
463
- {'parent' => request.parent}
464
- end
465
- )
466
- @list_notification_configs = Google::Gax.create_api_call(
467
- @security_center_stub.method(:list_notification_configs),
468
- defaults["list_notification_configs"],
469
- exception_transformer: exception_transformer,
470
- params_extractor: proc do |request|
471
- {'parent' => request.parent}
472
- end
473
- )
474
- @list_sources = Google::Gax.create_api_call(
475
- @security_center_stub.method(:list_sources),
476
- defaults["list_sources"],
477
- exception_transformer: exception_transformer,
478
- params_extractor: proc do |request|
479
- {'parent' => request.parent}
480
- end
481
- )
482
- @run_asset_discovery = Google::Gax.create_api_call(
483
- @security_center_stub.method(:run_asset_discovery),
484
- defaults["run_asset_discovery"],
485
- exception_transformer: exception_transformer,
486
- params_extractor: proc do |request|
487
- {'parent' => request.parent}
488
- end
489
- )
490
- @set_finding_state = Google::Gax.create_api_call(
491
- @security_center_stub.method(:set_finding_state),
492
- defaults["set_finding_state"],
493
- exception_transformer: exception_transformer,
494
- params_extractor: proc do |request|
495
- {'name' => request.name}
496
- end
497
- )
498
- @set_iam_policy = Google::Gax.create_api_call(
499
- @security_center_stub.method(:set_iam_policy),
500
- defaults["set_iam_policy"],
501
- exception_transformer: exception_transformer,
502
- params_extractor: proc do |request|
503
- {'resource' => request.resource}
504
- end
505
- )
506
- @update_finding = Google::Gax.create_api_call(
507
- @security_center_stub.method(:update_finding),
508
- defaults["update_finding"],
509
- exception_transformer: exception_transformer,
510
- params_extractor: proc do |request|
511
- {'finding.name' => request.finding.name}
512
- end
513
- )
514
- @update_notification_config = Google::Gax.create_api_call(
515
- @security_center_stub.method(:update_notification_config),
516
- defaults["update_notification_config"],
517
- exception_transformer: exception_transformer,
518
- params_extractor: proc do |request|
519
- {'notification_config.name' => request.notification_config.name}
520
- end
521
- )
522
- @update_organization_settings = Google::Gax.create_api_call(
523
- @security_center_stub.method(:update_organization_settings),
524
- defaults["update_organization_settings"],
525
- exception_transformer: exception_transformer,
526
- params_extractor: proc do |request|
527
- {'organization_settings.name' => request.organization_settings.name}
528
- end
529
- )
530
- @update_source = Google::Gax.create_api_call(
531
- @security_center_stub.method(:update_source),
532
- defaults["update_source"],
533
- exception_transformer: exception_transformer,
534
- params_extractor: proc do |request|
535
- {'source.name' => request.source.name}
536
- end
537
- )
538
- @update_security_marks = Google::Gax.create_api_call(
539
- @security_center_stub.method(:update_security_marks),
540
- defaults["update_security_marks"],
541
- exception_transformer: exception_transformer,
542
- params_extractor: proc do |request|
543
- {'security_marks.name' => request.security_marks.name}
544
- end
545
- )
546
- end
547
-
548
- # Service calls
549
-
550
- # Gets the access control policy on the specified Source.
551
- #
552
- # @param resource [String]
553
- # REQUIRED: The resource for which the policy is being requested.
554
- # See the operation documentation for the appropriate value for this field.
555
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
556
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
557
- # `GetIamPolicy`. This field is only used by Cloud IAM.
558
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
559
- # can also be provided.
560
- # @param options [Google::Gax::CallOptions]
561
- # Overrides the default settings for this call, e.g, timeout,
562
- # retries, etc.
563
- # @yield [result, operation] Access the result along with the RPC operation
564
- # @yieldparam result [Google::Iam::V1::Policy]
565
- # @yieldparam operation [GRPC::ActiveCall::Operation]
566
- # @return [Google::Iam::V1::Policy]
567
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
568
- # @example
569
- # require "google/cloud/security_center"
570
- #
571
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
572
- #
573
- # # TODO: Initialize `resource`:
574
- # resource = ''
575
- # response = security_center_client.get_iam_policy(resource)
576
-
577
- def get_iam_policy \
578
- resource,
579
- options_: nil,
580
- options: nil,
581
- &block
582
- req = {
583
- resource: resource,
584
- options: options_
585
- }.delete_if { |_, v| v.nil? }
586
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
587
- @get_iam_policy.call(req, options, &block)
588
- end
589
-
590
- # Filters an organization's assets and groups them by their specified
591
- # properties.
592
- #
593
- # @param parent [String]
594
- # Required. Name of the organization to groupBy. Its format is
595
- # "organizations/[organization_id]".
596
- # @param group_by [String]
597
- # Required. Expression that defines what assets fields to use for grouping.
598
- # The string value should follow SQL syntax: comma separated list of fields.
599
- # For example:
600
- # "security_center_properties.resource_project,security_center_properties.project".
601
- #
602
- # The following fields are supported when compare_duration is not set:
603
- #
604
- # * security_center_properties.resource_project
605
- # * security_center_properties.resource_project_display_name
606
- # * security_center_properties.resource_type
607
- # * security_center_properties.resource_parent
608
- # * security_center_properties.resource_parent_display_name
609
- #
610
- # The following fields are supported when compare_duration is set:
611
- #
612
- # * security_center_properties.resource_type
613
- # * security_center_properties.resource_project_display_name
614
- # * security_center_properties.resource_parent_display_name
615
- # @param filter [String]
616
- # Expression that defines the filter to apply across assets.
617
- # The expression is a list of zero or more restrictions combined via logical
618
- # operators `AND` and `OR`.
619
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
620
- #
621
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
622
- # character in front of them to indicate negation. The fields map to those
623
- # defined in the Asset resource. Examples include:
624
- #
625
- # * name
626
- # * security_center_properties.resource_name
627
- # * resource_properties.a_property
628
- # * security_marks.marks.marka
629
- #
630
- # The supported operators are:
631
- #
632
- # * `=` for all value types.
633
- # * `>`, `<`, `>=`, `<=` for integer values.
634
- # * `:`, meaning substring matching, for strings.
635
- #
636
- # The supported value types are:
637
- #
638
- # * string literals in quotes.
639
- # * integer literals without quotes.
640
- # * boolean literals `true` and `false` without quotes.
641
- #
642
- # The following field and operator combinations are supported:
643
- #
644
- # * name: `=`
645
- # * update_time: `=`, `>`, `<`, `>=`, `<=`
646
- #
647
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
648
- # Examples:
649
- # "update_time = \"2019-06-10T16:07:18-07:00\""
650
- # "update_time = 1560208038000"
651
- #
652
- # * create_time: `=`, `>`, `<`, `>=`, `<=`
653
- #
654
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
655
- # Examples:
656
- # "create_time = \"2019-06-10T16:07:18-07:00\""
657
- # "create_time = 1560208038000"
658
- #
659
- # * iam_policy.policy_blob: `=`, `:`
660
- # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
661
- # * security_marks.marks: `=`, `:`
662
- # * security_center_properties.resource_name: `=`, `:`
663
- # * security_center_properties.resource_display_name: `=`, `:`
664
- # * security_center_properties.resource_type: `=`, `:`
665
- # * security_center_properties.resource_parent: `=`, `:`
666
- # * security_center_properties.resource_parent_display_name: `=`, `:`
667
- # * security_center_properties.resource_project: `=`, `:`
668
- # * security_center_properties.resource_project_display_name: `=`, `:`
669
- # * security_center_properties.resource_owners: `=`, `:`
670
- #
671
- # For example, `resource_properties.size = 100` is a valid filter string.
672
- # @param compare_duration [Google::Protobuf::Duration | Hash]
673
- # When compare_duration is set, the GroupResult's "state_change" property is
674
- # updated to indicate whether the asset was added, removed, or remained
675
- # present during the compare_duration period of time that precedes the
676
- # read_time. This is the time between (read_time - compare_duration) and
677
- # read_time.
678
- #
679
- # The state change value is derived based on the presence of the asset at the
680
- # two points in time. Intermediate state changes between the two times don't
681
- # affect the result. For example, the results aren't affected if the asset is
682
- # removed and re-created again.
683
- #
684
- # Possible "state_change" values when compare_duration is specified:
685
- #
686
- # * "ADDED": indicates that the asset was not present at the start of
687
- # compare_duration, but present at reference_time.
688
- # * "REMOVED": indicates that the asset was present at the start of
689
- # compare_duration, but not present at reference_time.
690
- # * "ACTIVE": indicates that the asset was present at both the
691
- # start and the end of the time period defined by
692
- # compare_duration and reference_time.
693
- #
694
- # If compare_duration is not specified, then the only possible state_change
695
- # is "UNUSED", which will be the state_change set for all assets present at
696
- # read_time.
697
- #
698
- # If this field is set then `state_change` must be a specified field in
699
- # `group_by`.
700
- # A hash of the same form as `Google::Protobuf::Duration`
701
- # can also be provided.
702
- # @param read_time [Google::Protobuf::Timestamp | Hash]
703
- # Time used as a reference point when filtering assets. The filter is limited
704
- # to assets existing at the supplied time and their values are those at that
705
- # specific time. Absence of this field will default to the API's version of
706
- # NOW.
707
- # A hash of the same form as `Google::Protobuf::Timestamp`
708
- # can also be provided.
709
- # @param page_size [Integer]
710
- # The maximum number of resources contained in the underlying API
711
- # response. If page streaming is performed per-resource, this
712
- # parameter does not affect the return value. If page streaming is
713
- # performed per-page, this determines the maximum number of
714
- # resources in a page.
715
- # @param options [Google::Gax::CallOptions]
716
- # Overrides the default settings for this call, e.g, timeout,
717
- # retries, etc.
718
- # @yield [result, operation] Access the result along with the RPC operation
719
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
720
- # @yieldparam operation [GRPC::ActiveCall::Operation]
721
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
722
- # An enumerable of Google::Cloud::SecurityCenter::V1::GroupResult instances.
723
- # See Google::Gax::PagedEnumerable documentation for other
724
- # operations such as per-page iteration or access to the response
725
- # object.
726
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
727
- # @example
728
- # require "google/cloud/security_center"
729
- #
730
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
731
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
732
- #
733
- # # TODO: Initialize `group_by`:
734
- # group_by = ''
735
- #
736
- # # Iterate over all results.
737
- # security_center_client.group_assets(formatted_parent, group_by).each do |element|
738
- # # Process element.
739
- # end
740
- #
741
- # # Or iterate over results one page at a time.
742
- # security_center_client.group_assets(formatted_parent, group_by).each_page do |page|
743
- # # Process each page at a time.
744
- # page.each do |element|
745
- # # Process element.
746
- # end
747
- # end
748
-
749
- def group_assets \
750
- parent,
751
- group_by,
752
- filter: nil,
753
- compare_duration: nil,
754
- read_time: nil,
755
- page_size: nil,
756
- options: nil,
757
- &block
758
- req = {
759
- parent: parent,
760
- group_by: group_by,
761
- filter: filter,
762
- compare_duration: compare_duration,
763
- read_time: read_time,
764
- page_size: page_size
765
- }.delete_if { |_, v| v.nil? }
766
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GroupAssetsRequest)
767
- @group_assets.call(req, options, &block)
768
- end
769
-
770
- # Filters an organization or source's findings and groups them by their
771
- # specified properties.
772
- #
773
- # To group across all sources provide a `-` as the source id.
774
- # Example: /v1/organizations/{organization_id}/sources/-/findings
775
- #
776
- # @param parent [String]
777
- # Required. Name of the source to groupBy. Its format is
778
- # "organizations/[organization_id]/sources/[source_id]". To groupBy across
779
- # all sources provide a source_id of `-`. For example:
780
- # organizations/{organization_id}/sources/-
781
- # @param group_by [String]
782
- # Required. Expression that defines what assets fields to use for grouping
783
- # (including `state_change`). The string value should follow SQL syntax:
784
- # comma separated list of fields. For example: "parent,resource_name".
785
- #
786
- # The following fields are supported:
787
- #
788
- # * resource_name
789
- # * category
790
- # * state
791
- # * parent
792
- #
793
- # The following fields are supported when compare_duration is set:
794
- #
795
- # * state_change
796
- # @param filter [String]
797
- # Expression that defines the filter to apply across findings.
798
- # The expression is a list of one or more restrictions combined via logical
799
- # operators `AND` and `OR`.
800
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
801
- #
802
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
803
- # character in front of them to indicate negation. Examples include:
804
- #
805
- # * name
806
- # * source_properties.a_property
807
- # * security_marks.marks.marka
808
- #
809
- # The supported operators are:
810
- #
811
- # * `=` for all value types.
812
- # * `>`, `<`, `>=`, `<=` for integer values.
813
- # * `:`, meaning substring matching, for strings.
814
- #
815
- # The supported value types are:
816
- #
817
- # * string literals in quotes.
818
- # * integer literals without quotes.
819
- # * boolean literals `true` and `false` without quotes.
820
- #
821
- # The following field and operator combinations are supported:
822
- #
823
- # * name: `=`
824
- # * parent: `=`, `:`
825
- # * resource_name: `=`, `:`
826
- # * state: `=`, `:`
827
- # * category: `=`, `:`
828
- # * external_uri: `=`, `:`
829
- # * event_time: `=`, `>`, `<`, `>=`, `<=`
830
- #
831
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
832
- # Examples:
833
- # "event_time = \"2019-06-10T16:07:18-07:00\""
834
- # "event_time = 1560208038000"
835
- #
836
- # * security_marks.marks: `=`, `:`
837
- # * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
838
- #
839
- # For example, `source_properties.size = 100` is a valid filter string.
840
- # @param read_time [Google::Protobuf::Timestamp | Hash]
841
- # Time used as a reference point when filtering findings. The filter is
842
- # limited to findings existing at the supplied time and their values are
843
- # those at that specific time. Absence of this field will default to the
844
- # API's version of NOW.
845
- # A hash of the same form as `Google::Protobuf::Timestamp`
846
- # can also be provided.
847
- # @param compare_duration [Google::Protobuf::Duration | Hash]
848
- # When compare_duration is set, the GroupResult's "state_change" attribute is
849
- # updated to indicate whether the finding had its state changed, the
850
- # finding's state remained unchanged, or if the finding was added during the
851
- # compare_duration period of time that precedes the read_time. This is the
852
- # time between (read_time - compare_duration) and read_time.
853
- #
854
- # The state_change value is derived based on the presence and state of the
855
- # finding at the two points in time. Intermediate state changes between the
856
- # two times don't affect the result. For example, the results aren't affected
857
- # if the finding is made inactive and then active again.
858
- #
859
- # Possible "state_change" values when compare_duration is specified:
860
- #
861
- # * "CHANGED": indicates that the finding was present and matched the given
862
- # filter at the start of compare_duration, but changed its
863
- # state at read_time.
864
- # * "UNCHANGED": indicates that the finding was present and matched the given
865
- # filter at the start of compare_duration and did not change
866
- # state at read_time.
867
- # * "ADDED": indicates that the finding did not match the given filter or
868
- # was not present at the start of compare_duration, but was
869
- # present at read_time.
870
- # * "REMOVED": indicates that the finding was present and matched the
871
- # filter at the start of compare_duration, but did not match
872
- # the filter at read_time.
873
- #
874
- # If compare_duration is not specified, then the only possible state_change
875
- # is "UNUSED", which will be the state_change set for all findings present
876
- # at read_time.
877
- #
878
- # If this field is set then `state_change` must be a specified field in
879
- # `group_by`.
880
- # A hash of the same form as `Google::Protobuf::Duration`
881
- # can also be provided.
882
- # @param page_size [Integer]
883
- # The maximum number of resources contained in the underlying API
884
- # response. If page streaming is performed per-resource, this
885
- # parameter does not affect the return value. If page streaming is
886
- # performed per-page, this determines the maximum number of
887
- # resources in a page.
888
- # @param options [Google::Gax::CallOptions]
889
- # Overrides the default settings for this call, e.g, timeout,
890
- # retries, etc.
891
- # @yield [result, operation] Access the result along with the RPC operation
892
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
893
- # @yieldparam operation [GRPC::ActiveCall::Operation]
894
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
895
- # An enumerable of Google::Cloud::SecurityCenter::V1::GroupResult instances.
896
- # See Google::Gax::PagedEnumerable documentation for other
897
- # operations such as per-page iteration or access to the response
898
- # object.
899
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
900
- # @example
901
- # require "google/cloud/security_center"
902
- #
903
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
904
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
905
- #
906
- # # TODO: Initialize `group_by`:
907
- # group_by = ''
908
- #
909
- # # Iterate over all results.
910
- # security_center_client.group_findings(formatted_parent, group_by).each do |element|
911
- # # Process element.
912
- # end
913
- #
914
- # # Or iterate over results one page at a time.
915
- # security_center_client.group_findings(formatted_parent, group_by).each_page do |page|
916
- # # Process each page at a time.
917
- # page.each do |element|
918
- # # Process element.
919
- # end
920
- # end
921
-
922
- def group_findings \
923
- parent,
924
- group_by,
925
- filter: nil,
926
- read_time: nil,
927
- compare_duration: nil,
928
- page_size: nil,
929
- options: nil,
930
- &block
931
- req = {
932
- parent: parent,
933
- group_by: group_by,
934
- filter: filter,
935
- read_time: read_time,
936
- compare_duration: compare_duration,
937
- page_size: page_size
938
- }.delete_if { |_, v| v.nil? }
939
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GroupFindingsRequest)
940
- @group_findings.call(req, options, &block)
941
- end
942
-
943
- # Returns the permissions that a caller has on the specified source.
944
- #
945
- # @param resource [String]
946
- # REQUIRED: The resource for which the policy detail is being requested.
947
- # See the operation documentation for the appropriate value for this field.
948
- # @param permissions [Array<String>]
949
- # The set of permissions to check for the `resource`. Permissions with
950
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
951
- # information see
952
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
953
- # @param options [Google::Gax::CallOptions]
954
- # Overrides the default settings for this call, e.g, timeout,
955
- # retries, etc.
956
- # @yield [result, operation] Access the result along with the RPC operation
957
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
958
- # @yieldparam operation [GRPC::ActiveCall::Operation]
959
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
960
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
961
- # @example
962
- # require "google/cloud/security_center"
963
- #
964
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
965
- #
966
- # # TODO: Initialize `resource`:
967
- # resource = ''
968
- #
969
- # # TODO: Initialize `permissions`:
970
- # permissions = []
971
- # response = security_center_client.test_iam_permissions(resource, permissions)
972
-
973
- def test_iam_permissions \
974
- resource,
975
- permissions,
976
- options: nil,
977
- &block
978
- req = {
979
- resource: resource,
980
- permissions: permissions
981
- }.delete_if { |_, v| v.nil? }
982
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
983
- @test_iam_permissions.call(req, options, &block)
984
- end
985
-
986
- # Creates a source.
987
- #
988
- # @param parent [String]
989
- # Required. Resource name of the new source's parent. Its format should be
990
- # "organizations/[organization_id]".
991
- # @param source [Google::Cloud::SecurityCenter::V1::Source | Hash]
992
- # Required. The Source being created, only the display_name and description
993
- # will be used. All other fields will be ignored.
994
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Source`
995
- # can also be provided.
996
- # @param options [Google::Gax::CallOptions]
997
- # Overrides the default settings for this call, e.g, timeout,
998
- # retries, etc.
999
- # @yield [result, operation] Access the result along with the RPC operation
1000
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
1001
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1002
- # @return [Google::Cloud::SecurityCenter::V1::Source]
1003
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1004
- # @example
1005
- # require "google/cloud/security_center"
1006
- #
1007
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1008
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1009
- #
1010
- # # TODO: Initialize `source`:
1011
- # source = {}
1012
- # response = security_center_client.create_source(formatted_parent, source)
1013
-
1014
- def create_source \
1015
- parent,
1016
- source,
1017
- options: nil,
1018
- &block
1019
- req = {
1020
- parent: parent,
1021
- source: source
1022
- }.delete_if { |_, v| v.nil? }
1023
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateSourceRequest)
1024
- @create_source.call(req, options, &block)
1025
- end
1026
-
1027
- # Creates a finding. The corresponding source must exist for finding creation
1028
- # to succeed.
1029
- #
1030
- # @param parent [String]
1031
- # Required. Resource name of the new finding's parent. Its format should be
1032
- # "organizations/[organization_id]/sources/[source_id]".
1033
- # @param finding_id [String]
1034
- # Required. Unique identifier provided by the client within the parent scope.
1035
- # It must be alphanumeric and less than or equal to 32 characters and
1036
- # greater than 0 characters in length.
1037
- # @param finding [Google::Cloud::SecurityCenter::V1::Finding | Hash]
1038
- # Required. The Finding being created. The name and security_marks will be
1039
- # ignored as they are both output only fields on this resource.
1040
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Finding`
1041
- # can also be provided.
1042
- # @param options [Google::Gax::CallOptions]
1043
- # Overrides the default settings for this call, e.g, timeout,
1044
- # retries, etc.
1045
- # @yield [result, operation] Access the result along with the RPC operation
1046
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1047
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1048
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1049
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1050
- # @example
1051
- # require "google/cloud/security_center"
1052
- #
1053
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1054
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1055
- #
1056
- # # TODO: Initialize `finding_id`:
1057
- # finding_id = ''
1058
- #
1059
- # # TODO: Initialize `finding`:
1060
- # finding = {}
1061
- # response = security_center_client.create_finding(formatted_parent, finding_id, finding)
1062
-
1063
- def create_finding \
1064
- parent,
1065
- finding_id,
1066
- finding,
1067
- options: nil,
1068
- &block
1069
- req = {
1070
- parent: parent,
1071
- finding_id: finding_id,
1072
- finding: finding
1073
- }.delete_if { |_, v| v.nil? }
1074
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateFindingRequest)
1075
- @create_finding.call(req, options, &block)
1076
- end
1077
-
1078
- # Creates a notification config.
1079
- #
1080
- # @param parent [String]
1081
- # Required. Resource name of the new notification config's parent. Its format
1082
- # is "organizations/[organization_id]".
1083
- # @param config_id [String]
1084
- # Required.
1085
- # Unique identifier provided by the client within the parent scope.
1086
- # It must be between 1 and 128 characters, and contains alphanumeric
1087
- # characters, underscores or hyphens only.
1088
- # @param notification_config [Google::Cloud::SecurityCenter::V1::NotificationConfig | Hash]
1089
- # Required. The notification config being created. The name and the service
1090
- # account will be ignored as they are both output only fields on this
1091
- # resource.
1092
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::NotificationConfig`
1093
- # can also be provided.
1094
- # @param options [Google::Gax::CallOptions]
1095
- # Overrides the default settings for this call, e.g, timeout,
1096
- # retries, etc.
1097
- # @yield [result, operation] Access the result along with the RPC operation
1098
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1099
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1100
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1101
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1102
- # @example
1103
- # require "google/cloud/security_center"
1104
- #
1105
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1106
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1107
- #
1108
- # # TODO: Initialize `config_id`:
1109
- # config_id = ''
1110
- #
1111
- # # TODO: Initialize `notification_config`:
1112
- # notification_config = {}
1113
- # response = security_center_client.create_notification_config(formatted_parent, config_id, notification_config)
1114
-
1115
- def create_notification_config \
1116
- parent,
1117
- config_id,
1118
- notification_config,
1119
- options: nil,
1120
- &block
1121
- req = {
1122
- parent: parent,
1123
- config_id: config_id,
1124
- notification_config: notification_config
1125
- }.delete_if { |_, v| v.nil? }
1126
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateNotificationConfigRequest)
1127
- @create_notification_config.call(req, options, &block)
1128
- end
1129
-
1130
- # Deletes a notification config.
1131
- #
1132
- # @param name [String]
1133
- # Required. Name of the notification config to delete. Its format is
1134
- # "organizations/[organization_id]/notificationConfigs/[config_id]".
1135
- # @param options [Google::Gax::CallOptions]
1136
- # Overrides the default settings for this call, e.g, timeout,
1137
- # retries, etc.
1138
- # @yield [result, operation] Access the result along with the RPC operation
1139
- # @yieldparam result []
1140
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1141
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1142
- # @example
1143
- # require "google/cloud/security_center"
1144
- #
1145
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1146
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.notification_config_path("[ORGANIZATION]", "[NOTIFICATION_CONFIG]")
1147
- # security_center_client.delete_notification_config(formatted_name)
1148
-
1149
- def delete_notification_config \
1150
- name,
1151
- options: nil,
1152
- &block
1153
- req = {
1154
- name: name
1155
- }.delete_if { |_, v| v.nil? }
1156
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::DeleteNotificationConfigRequest)
1157
- @delete_notification_config.call(req, options, &block)
1158
- nil
1159
- end
1160
-
1161
- # Gets a notification config.
1162
- #
1163
- # @param name [String]
1164
- # Required. Name of the notification config to get. Its format is
1165
- # "organizations/[organization_id]/notificationConfigs/[config_id]".
1166
- # @param options [Google::Gax::CallOptions]
1167
- # Overrides the default settings for this call, e.g, timeout,
1168
- # retries, etc.
1169
- # @yield [result, operation] Access the result along with the RPC operation
1170
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1171
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1172
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1173
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1174
- # @example
1175
- # require "google/cloud/security_center"
1176
- #
1177
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1178
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.notification_config_path("[ORGANIZATION]", "[NOTIFICATION_CONFIG]")
1179
- # response = security_center_client.get_notification_config(formatted_name)
1180
-
1181
- def get_notification_config \
1182
- name,
1183
- options: nil,
1184
- &block
1185
- req = {
1186
- name: name
1187
- }.delete_if { |_, v| v.nil? }
1188
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetNotificationConfigRequest)
1189
- @get_notification_config.call(req, options, &block)
1190
- end
1191
-
1192
- # Gets the settings for an organization.
1193
- #
1194
- # @param name [String]
1195
- # Required. Name of the organization to get organization settings for. Its
1196
- # format is "organizations/[organization_id]/organizationSettings".
1197
- # @param options [Google::Gax::CallOptions]
1198
- # Overrides the default settings for this call, e.g, timeout,
1199
- # retries, etc.
1200
- # @yield [result, operation] Access the result along with the RPC operation
1201
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1202
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1203
- # @return [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1204
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1205
- # @example
1206
- # require "google/cloud/security_center"
1207
- #
1208
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1209
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_settings_path("[ORGANIZATION]")
1210
- # response = security_center_client.get_organization_settings(formatted_name)
1211
-
1212
- def get_organization_settings \
1213
- name,
1214
- options: nil,
1215
- &block
1216
- req = {
1217
- name: name
1218
- }.delete_if { |_, v| v.nil? }
1219
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetOrganizationSettingsRequest)
1220
- @get_organization_settings.call(req, options, &block)
1221
- end
1222
-
1223
- # Gets a source.
1224
- #
1225
- # @param name [String]
1226
- # Required. Relative resource name of the source. Its format is
1227
- # "organizations/[organization_id]/source/[source_id]".
1228
- # @param options [Google::Gax::CallOptions]
1229
- # Overrides the default settings for this call, e.g, timeout,
1230
- # retries, etc.
1231
- # @yield [result, operation] Access the result along with the RPC operation
1232
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
1233
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1234
- # @return [Google::Cloud::SecurityCenter::V1::Source]
1235
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1236
- # @example
1237
- # require "google/cloud/security_center"
1238
- #
1239
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1240
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1241
- # response = security_center_client.get_source(formatted_name)
1242
-
1243
- def get_source \
1244
- name,
1245
- options: nil,
1246
- &block
1247
- req = {
1248
- name: name
1249
- }.delete_if { |_, v| v.nil? }
1250
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetSourceRequest)
1251
- @get_source.call(req, options, &block)
1252
- end
1253
-
1254
- # Lists an organization's assets.
1255
- #
1256
- # @param parent [String]
1257
- # Required. Name of the organization assets should belong to. Its format is
1258
- # "organizations/[organization_id]".
1259
- # @param filter [String]
1260
- # Expression that defines the filter to apply across assets.
1261
- # The expression is a list of zero or more restrictions combined via logical
1262
- # operators `AND` and `OR`.
1263
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
1264
- #
1265
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1266
- # character in front of them to indicate negation. The fields map to those
1267
- # defined in the Asset resource. Examples include:
1268
- #
1269
- # * name
1270
- # * security_center_properties.resource_name
1271
- # * resource_properties.a_property
1272
- # * security_marks.marks.marka
1273
- #
1274
- # The supported operators are:
1275
- #
1276
- # * `=` for all value types.
1277
- # * `>`, `<`, `>=`, `<=` for integer values.
1278
- # * `:`, meaning substring matching, for strings.
1279
- #
1280
- # The supported value types are:
1281
- #
1282
- # * string literals in quotes.
1283
- # * integer literals without quotes.
1284
- # * boolean literals `true` and `false` without quotes.
1285
- #
1286
- # The following are the allowed field and operator combinations:
1287
- #
1288
- # * name: `=`
1289
- # * update_time: `=`, `>`, `<`, `>=`, `<=`
1290
- #
1291
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1292
- # Examples:
1293
- # "update_time = \"2019-06-10T16:07:18-07:00\""
1294
- # "update_time = 1560208038000"
1295
- #
1296
- # * create_time: `=`, `>`, `<`, `>=`, `<=`
1297
- #
1298
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1299
- # Examples:
1300
- # "create_time = \"2019-06-10T16:07:18-07:00\""
1301
- # "create_time = 1560208038000"
1302
- #
1303
- # * iam_policy.policy_blob: `=`, `:`
1304
- # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1305
- # * security_marks.marks: `=`, `:`
1306
- # * security_center_properties.resource_name: `=`, `:`
1307
- # * security_center_properties.resource_display_name: `=`, `:`
1308
- # * security_center_properties.resource_type: `=`, `:`
1309
- # * security_center_properties.resource_parent: `=`, `:`
1310
- # * security_center_properties.resource_parent_display_name: `=`, `:`
1311
- # * security_center_properties.resource_project: `=`, `:`
1312
- # * security_center_properties.resource_project_display_name: `=`, `:`
1313
- # * security_center_properties.resource_owners: `=`, `:`
1314
- #
1315
- # For example, `resource_properties.size = 100` is a valid filter string.
1316
- # @param order_by [String]
1317
- # Expression that defines what fields and order to use for sorting. The
1318
- # string value should follow SQL syntax: comma separated list of fields. For
1319
- # example: "name,resource_properties.a_property". The default sorting order
1320
- # is ascending. To specify descending order for a field, a suffix " desc"
1321
- # should be appended to the field name. For example: "name
1322
- # desc,resource_properties.a_property". Redundant space characters in the
1323
- # syntax are insignificant. "name desc,resource_properties.a_property" and "
1324
- # name desc , resource_properties.a_property " are equivalent.
1325
- #
1326
- # The following fields are supported:
1327
- # name
1328
- # update_time
1329
- # resource_properties
1330
- # security_marks.marks
1331
- # security_center_properties.resource_name
1332
- # security_center_properties.resource_display_name
1333
- # security_center_properties.resource_parent
1334
- # security_center_properties.resource_parent_display_name
1335
- # security_center_properties.resource_project
1336
- # security_center_properties.resource_project_display_name
1337
- # security_center_properties.resource_type
1338
- # @param read_time [Google::Protobuf::Timestamp | Hash]
1339
- # Time used as a reference point when filtering assets. The filter is limited
1340
- # to assets existing at the supplied time and their values are those at that
1341
- # specific time. Absence of this field will default to the API's version of
1342
- # NOW.
1343
- # A hash of the same form as `Google::Protobuf::Timestamp`
1344
- # can also be provided.
1345
- # @param compare_duration [Google::Protobuf::Duration | Hash]
1346
- # When compare_duration is set, the ListAssetsResult's "state_change"
1347
- # attribute is updated to indicate whether the asset was added, removed, or
1348
- # remained present during the compare_duration period of time that precedes
1349
- # the read_time. This is the time between (read_time - compare_duration) and
1350
- # read_time.
1351
- #
1352
- # The state_change value is derived based on the presence of the asset at the
1353
- # two points in time. Intermediate state changes between the two times don't
1354
- # affect the result. For example, the results aren't affected if the asset is
1355
- # removed and re-created again.
1356
- #
1357
- # Possible "state_change" values when compare_duration is specified:
1358
- #
1359
- # * "ADDED": indicates that the asset was not present at the start of
1360
- # compare_duration, but present at read_time.
1361
- # * "REMOVED": indicates that the asset was present at the start of
1362
- # compare_duration, but not present at read_time.
1363
- # * "ACTIVE": indicates that the asset was present at both the
1364
- # start and the end of the time period defined by
1365
- # compare_duration and read_time.
1366
- #
1367
- # If compare_duration is not specified, then the only possible state_change
1368
- # is "UNUSED", which will be the state_change set for all assets present at
1369
- # read_time.
1370
- # A hash of the same form as `Google::Protobuf::Duration`
1371
- # can also be provided.
1372
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
1373
- # Optional. A field mask to specify the ListAssetsResult fields to be listed
1374
- # in the response. An empty field mask will list all fields.
1375
- # A hash of the same form as `Google::Protobuf::FieldMask`
1376
- # can also be provided.
1377
- # @param page_size [Integer]
1378
- # The maximum number of resources contained in the underlying API
1379
- # response. If page streaming is performed per-resource, this
1380
- # parameter does not affect the return value. If page streaming is
1381
- # performed per-page, this determines the maximum number of
1382
- # resources in a page.
1383
- # @param options [Google::Gax::CallOptions]
1384
- # Overrides the default settings for this call, e.g, timeout,
1385
- # retries, etc.
1386
- # @yield [result, operation] Access the result along with the RPC operation
1387
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
1388
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1389
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
1390
- # An enumerable of Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult instances.
1391
- # See Google::Gax::PagedEnumerable documentation for other
1392
- # operations such as per-page iteration or access to the response
1393
- # object.
1394
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1395
- # @example
1396
- # require "google/cloud/security_center"
1397
- #
1398
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1399
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1400
- #
1401
- # # Iterate over all results.
1402
- # security_center_client.list_assets(formatted_parent).each do |element|
1403
- # # Process element.
1404
- # end
1405
- #
1406
- # # Or iterate over results one page at a time.
1407
- # security_center_client.list_assets(formatted_parent).each_page do |page|
1408
- # # Process each page at a time.
1409
- # page.each do |element|
1410
- # # Process element.
1411
- # end
1412
- # end
1413
-
1414
- def list_assets \
1415
- parent,
1416
- filter: nil,
1417
- order_by: nil,
1418
- read_time: nil,
1419
- compare_duration: nil,
1420
- field_mask: nil,
1421
- page_size: nil,
1422
- options: nil,
1423
- &block
1424
- req = {
1425
- parent: parent,
1426
- filter: filter,
1427
- order_by: order_by,
1428
- read_time: read_time,
1429
- compare_duration: compare_duration,
1430
- field_mask: field_mask,
1431
- page_size: page_size
1432
- }.delete_if { |_, v| v.nil? }
1433
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListAssetsRequest)
1434
- @list_assets.call(req, options, &block)
1435
- end
1436
-
1437
- # Lists an organization or source's findings.
1438
- #
1439
- # To list across all sources provide a `-` as the source id.
1440
- # Example: /v1/organizations/{organization_id}/sources/-/findings
1441
- #
1442
- # @param parent [String]
1443
- # Required. Name of the source the findings belong to. Its format is
1444
- # "organizations/[organization_id]/sources/[source_id]". To list across all
1445
- # sources provide a source_id of `-`. For example:
1446
- # organizations/{organization_id}/sources/-
1447
- # @param filter [String]
1448
- # Expression that defines the filter to apply across findings.
1449
- # The expression is a list of one or more restrictions combined via logical
1450
- # operators `AND` and `OR`.
1451
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
1452
- #
1453
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1454
- # character in front of them to indicate negation. Examples include:
1455
- #
1456
- # * name
1457
- # * source_properties.a_property
1458
- # * security_marks.marks.marka
1459
- #
1460
- # The supported operators are:
1461
- #
1462
- # * `=` for all value types.
1463
- # * `>`, `<`, `>=`, `<=` for integer values.
1464
- # * `:`, meaning substring matching, for strings.
1465
- #
1466
- # The supported value types are:
1467
- #
1468
- # * string literals in quotes.
1469
- # * integer literals without quotes.
1470
- # * boolean literals `true` and `false` without quotes.
1471
- #
1472
- # The following field and operator combinations are supported:
1473
- #
1474
- # name: `=`
1475
- # parent: `=`, `:`
1476
- # resource_name: `=`, `:`
1477
- # state: `=`, `:`
1478
- # category: `=`, `:`
1479
- # external_uri: `=`, `:`
1480
- # event_time: `=`, `>`, `<`, `>=`, `<=`
1481
- #
1482
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1483
- # Examples:
1484
- # "event_time = \"2019-06-10T16:07:18-07:00\""
1485
- # "event_time = 1560208038000"
1486
- #
1487
- # security_marks.marks: `=`, `:`
1488
- # source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1489
- #
1490
- # For example, `source_properties.size = 100` is a valid filter string.
1491
- # @param order_by [String]
1492
- # Expression that defines what fields and order to use for sorting. The
1493
- # string value should follow SQL syntax: comma separated list of fields. For
1494
- # example: "name,resource_properties.a_property". The default sorting order
1495
- # is ascending. To specify descending order for a field, a suffix " desc"
1496
- # should be appended to the field name. For example: "name
1497
- # desc,source_properties.a_property". Redundant space characters in the
1498
- # syntax are insignificant. "name desc,source_properties.a_property" and "
1499
- # name desc , source_properties.a_property " are equivalent.
1500
- #
1501
- # The following fields are supported:
1502
- # name
1503
- # parent
1504
- # state
1505
- # category
1506
- # resource_name
1507
- # event_time
1508
- # source_properties
1509
- # security_marks.marks
1510
- # @param read_time [Google::Protobuf::Timestamp | Hash]
1511
- # Time used as a reference point when filtering findings. The filter is
1512
- # limited to findings existing at the supplied time and their values are
1513
- # those at that specific time. Absence of this field will default to the
1514
- # API's version of NOW.
1515
- # A hash of the same form as `Google::Protobuf::Timestamp`
1516
- # can also be provided.
1517
- # @param compare_duration [Google::Protobuf::Duration | Hash]
1518
- # When compare_duration is set, the ListFindingsResult's "state_change"
1519
- # attribute is updated to indicate whether the finding had its state changed,
1520
- # the finding's state remained unchanged, or if the finding was added in any
1521
- # state during the compare_duration period of time that precedes the
1522
- # read_time. This is the time between (read_time - compare_duration) and
1523
- # read_time.
1524
- #
1525
- # The state_change value is derived based on the presence and state of the
1526
- # finding at the two points in time. Intermediate state changes between the
1527
- # two times don't affect the result. For example, the results aren't affected
1528
- # if the finding is made inactive and then active again.
1529
- #
1530
- # Possible "state_change" values when compare_duration is specified:
1531
- #
1532
- # * "CHANGED": indicates that the finding was present and matched the given
1533
- # filter at the start of compare_duration, but changed its
1534
- # state at read_time.
1535
- # * "UNCHANGED": indicates that the finding was present and matched the given
1536
- # filter at the start of compare_duration and did not change
1537
- # state at read_time.
1538
- # * "ADDED": indicates that the finding did not match the given filter or
1539
- # was not present at the start of compare_duration, but was
1540
- # present at read_time.
1541
- # * "REMOVED": indicates that the finding was present and matched the
1542
- # filter at the start of compare_duration, but did not match
1543
- # the filter at read_time.
1544
- #
1545
- # If compare_duration is not specified, then the only possible state_change
1546
- # is "UNUSED", which will be the state_change set for all findings present at
1547
- # read_time.
1548
- # A hash of the same form as `Google::Protobuf::Duration`
1549
- # can also be provided.
1550
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
1551
- # Optional. A field mask to specify the Finding fields to be listed in the
1552
- # response. An empty field mask will list all fields.
1553
- # A hash of the same form as `Google::Protobuf::FieldMask`
1554
- # can also be provided.
1555
- # @param page_size [Integer]
1556
- # The maximum number of resources contained in the underlying API
1557
- # response. If page streaming is performed per-resource, this
1558
- # parameter does not affect the return value. If page streaming is
1559
- # performed per-page, this determines the maximum number of
1560
- # resources in a page.
1561
- # @param options [Google::Gax::CallOptions]
1562
- # Overrides the default settings for this call, e.g, timeout,
1563
- # retries, etc.
1564
- # @yield [result, operation] Access the result along with the RPC operation
1565
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
1566
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1567
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
1568
- # An enumerable of Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult instances.
1569
- # See Google::Gax::PagedEnumerable documentation for other
1570
- # operations such as per-page iteration or access to the response
1571
- # object.
1572
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1573
- # @example
1574
- # require "google/cloud/security_center"
1575
- #
1576
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1577
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1578
- #
1579
- # # Iterate over all results.
1580
- # security_center_client.list_findings(formatted_parent).each do |element|
1581
- # # Process element.
1582
- # end
1583
- #
1584
- # # Or iterate over results one page at a time.
1585
- # security_center_client.list_findings(formatted_parent).each_page do |page|
1586
- # # Process each page at a time.
1587
- # page.each do |element|
1588
- # # Process element.
1589
- # end
1590
- # end
1591
-
1592
- def list_findings \
1593
- parent,
1594
- filter: nil,
1595
- order_by: nil,
1596
- read_time: nil,
1597
- compare_duration: nil,
1598
- field_mask: nil,
1599
- page_size: nil,
1600
- options: nil,
1601
- &block
1602
- req = {
1603
- parent: parent,
1604
- filter: filter,
1605
- order_by: order_by,
1606
- read_time: read_time,
1607
- compare_duration: compare_duration,
1608
- field_mask: field_mask,
1609
- page_size: page_size
1610
- }.delete_if { |_, v| v.nil? }
1611
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListFindingsRequest)
1612
- @list_findings.call(req, options, &block)
1613
- end
1614
-
1615
- # Lists notification configs.
1616
- #
1617
- # @param parent [String]
1618
- # Required. Name of the organization to list notification configs.
1619
- # Its format is "organizations/[organization_id]".
1620
- # @param page_size [Integer]
1621
- # The maximum number of resources contained in the underlying API
1622
- # response. If page streaming is performed per-resource, this
1623
- # parameter does not affect the return value. If page streaming is
1624
- # performed per-page, this determines the maximum number of
1625
- # resources in a page.
1626
- # @param options [Google::Gax::CallOptions]
1627
- # Overrides the default settings for this call, e.g, timeout,
1628
- # retries, etc.
1629
- # @yield [result, operation] Access the result along with the RPC operation
1630
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
1631
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1632
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
1633
- # An enumerable of Google::Cloud::SecurityCenter::V1::NotificationConfig instances.
1634
- # See Google::Gax::PagedEnumerable documentation for other
1635
- # operations such as per-page iteration or access to the response
1636
- # object.
1637
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1638
- # @example
1639
- # require "google/cloud/security_center"
1640
- #
1641
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1642
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1643
- #
1644
- # # Iterate over all results.
1645
- # security_center_client.list_notification_configs(formatted_parent).each do |element|
1646
- # # Process element.
1647
- # end
1648
- #
1649
- # # Or iterate over results one page at a time.
1650
- # security_center_client.list_notification_configs(formatted_parent).each_page do |page|
1651
- # # Process each page at a time.
1652
- # page.each do |element|
1653
- # # Process element.
1654
- # end
1655
- # end
1656
-
1657
- def list_notification_configs \
1658
- parent,
1659
- page_size: nil,
1660
- options: nil,
1661
- &block
1662
- req = {
1663
- parent: parent,
1664
- page_size: page_size
1665
- }.delete_if { |_, v| v.nil? }
1666
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest)
1667
- @list_notification_configs.call(req, options, &block)
1668
- end
1669
-
1670
- # Lists all sources belonging to an organization.
1671
- #
1672
- # @param parent [String]
1673
- # Required. Resource name of the parent of sources to list. Its format should
1674
- # be "organizations/[organization_id]".
1675
- # @param page_size [Integer]
1676
- # The maximum number of resources contained in the underlying API
1677
- # response. If page streaming is performed per-resource, this
1678
- # parameter does not affect the return value. If page streaming is
1679
- # performed per-page, this determines the maximum number of
1680
- # resources in a page.
1681
- # @param options [Google::Gax::CallOptions]
1682
- # Overrides the default settings for this call, e.g, timeout,
1683
- # retries, etc.
1684
- # @yield [result, operation] Access the result along with the RPC operation
1685
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
1686
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1687
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
1688
- # An enumerable of Google::Cloud::SecurityCenter::V1::Source instances.
1689
- # See Google::Gax::PagedEnumerable documentation for other
1690
- # operations such as per-page iteration or access to the response
1691
- # object.
1692
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1693
- # @example
1694
- # require "google/cloud/security_center"
1695
- #
1696
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1697
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1698
- #
1699
- # # Iterate over all results.
1700
- # security_center_client.list_sources(formatted_parent).each do |element|
1701
- # # Process element.
1702
- # end
1703
- #
1704
- # # Or iterate over results one page at a time.
1705
- # security_center_client.list_sources(formatted_parent).each_page do |page|
1706
- # # Process each page at a time.
1707
- # page.each do |element|
1708
- # # Process element.
1709
- # end
1710
- # end
1711
-
1712
- def list_sources \
1713
- parent,
1714
- page_size: nil,
1715
- options: nil,
1716
- &block
1717
- req = {
1718
- parent: parent,
1719
- page_size: page_size
1720
- }.delete_if { |_, v| v.nil? }
1721
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListSourcesRequest)
1722
- @list_sources.call(req, options, &block)
1723
- end
1724
-
1725
- # Runs asset discovery. The discovery is tracked with a long-running
1726
- # operation.
1727
- #
1728
- # This API can only be called with limited frequency for an organization. If
1729
- # it is called too frequently the caller will receive a TOO_MANY_REQUESTS
1730
- # error.
1731
- #
1732
- # @param parent [String]
1733
- # Required. Name of the organization to run asset discovery for. Its format
1734
- # is "organizations/[organization_id]".
1735
- # @param options [Google::Gax::CallOptions]
1736
- # Overrides the default settings for this call, e.g, timeout,
1737
- # retries, etc.
1738
- # @return [Google::Gax::Operation]
1739
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1740
- # @example
1741
- # require "google/cloud/security_center"
1742
- #
1743
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1744
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1745
- #
1746
- # # Register a callback during the method call.
1747
- # operation = security_center_client.run_asset_discovery(formatted_parent) do |op|
1748
- # raise op.results.message if op.error?
1749
- # op_results = op.results
1750
- # # Process the results.
1751
- #
1752
- # metadata = op.metadata
1753
- # # Process the metadata.
1754
- # end
1755
- #
1756
- # # Or use the return value to register a callback.
1757
- # operation.on_done do |op|
1758
- # raise op.results.message if op.error?
1759
- # op_results = op.results
1760
- # # Process the results.
1761
- #
1762
- # metadata = op.metadata
1763
- # # Process the metadata.
1764
- # end
1765
- #
1766
- # # Manually reload the operation.
1767
- # operation.reload!
1768
- #
1769
- # # Or block until the operation completes, triggering callbacks on
1770
- # # completion.
1771
- # operation.wait_until_done!
1772
-
1773
- def run_asset_discovery \
1774
- parent,
1775
- options: nil
1776
- req = {
1777
- parent: parent
1778
- }.delete_if { |_, v| v.nil? }
1779
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest)
1780
- operation = Google::Gax::Operation.new(
1781
- @run_asset_discovery.call(req, options),
1782
- @operations_client,
1783
- Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryResponse,
1784
- Google::Protobuf::Empty,
1785
- call_options: options
1786
- )
1787
- operation.on_done { |operation| yield(operation) } if block_given?
1788
- operation
1789
- end
1790
-
1791
- # Updates the state of a finding.
1792
- #
1793
- # @param name [String]
1794
- # Required. The relative resource name of the finding. See:
1795
- # https://cloud.google.com/apis/design/resource_names#relative_resource_name
1796
- # Example:
1797
- # "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}".
1798
- # @param state [Google::Cloud::SecurityCenter::V1::Finding::State]
1799
- # Required. The desired State of the finding.
1800
- # @param start_time [Google::Protobuf::Timestamp | Hash]
1801
- # Required. The time at which the updated state takes effect.
1802
- # A hash of the same form as `Google::Protobuf::Timestamp`
1803
- # can also be provided.
1804
- # @param options [Google::Gax::CallOptions]
1805
- # Overrides the default settings for this call, e.g, timeout,
1806
- # retries, etc.
1807
- # @yield [result, operation] Access the result along with the RPC operation
1808
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1809
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1810
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1811
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1812
- # @example
1813
- # require "google/cloud/security_center"
1814
- #
1815
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1816
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.finding_path("[ORGANIZATION]", "[SOURCE]", "[FINDING]")
1817
- #
1818
- # # TODO: Initialize `state`:
1819
- # state = :STATE_UNSPECIFIED
1820
- #
1821
- # # TODO: Initialize `start_time`:
1822
- # start_time = {}
1823
- # response = security_center_client.set_finding_state(formatted_name, state, start_time)
1824
-
1825
- def set_finding_state \
1826
- name,
1827
- state,
1828
- start_time,
1829
- options: nil,
1830
- &block
1831
- req = {
1832
- name: name,
1833
- state: state,
1834
- start_time: start_time
1835
- }.delete_if { |_, v| v.nil? }
1836
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::SetFindingStateRequest)
1837
- @set_finding_state.call(req, options, &block)
1838
- end
1839
-
1840
- # Sets the access control policy on the specified Source.
1841
- #
1842
- # @param resource [String]
1843
- # REQUIRED: The resource for which the policy is being specified.
1844
- # See the operation documentation for the appropriate value for this field.
1845
- # @param policy [Google::Iam::V1::Policy | Hash]
1846
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
1847
- # the policy is limited to a few 10s of KB. An empty policy is a
1848
- # valid policy but certain Cloud Platform services (such as Projects)
1849
- # might reject them.
1850
- # A hash of the same form as `Google::Iam::V1::Policy`
1851
- # can also be provided.
1852
- # @param options [Google::Gax::CallOptions]
1853
- # Overrides the default settings for this call, e.g, timeout,
1854
- # retries, etc.
1855
- # @yield [result, operation] Access the result along with the RPC operation
1856
- # @yieldparam result [Google::Iam::V1::Policy]
1857
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1858
- # @return [Google::Iam::V1::Policy]
1859
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1860
- # @example
1861
- # require "google/cloud/security_center"
1862
- #
1863
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1864
- #
1865
- # # TODO: Initialize `resource`:
1866
- # resource = ''
1867
- #
1868
- # # TODO: Initialize `policy`:
1869
- # policy = {}
1870
- # response = security_center_client.set_iam_policy(resource, policy)
1871
-
1872
- def set_iam_policy \
1873
- resource,
1874
- policy,
1875
- options: nil,
1876
- &block
1877
- req = {
1878
- resource: resource,
1879
- policy: policy
1880
- }.delete_if { |_, v| v.nil? }
1881
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
1882
- @set_iam_policy.call(req, options, &block)
1883
- end
1884
-
1885
- # Creates or updates a finding. The corresponding source must exist for a
1886
- # finding creation to succeed.
1887
- #
1888
- # @param finding [Google::Cloud::SecurityCenter::V1::Finding | Hash]
1889
- # Required. The finding resource to update or create if it does not already
1890
- # exist. parent, security_marks, and update_time will be ignored.
1891
- #
1892
- # In the case of creation, the finding id portion of the name must be
1893
- # alphanumeric and less than or equal to 32 characters and greater than 0
1894
- # characters in length.
1895
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Finding`
1896
- # can also be provided.
1897
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1898
- # The FieldMask to use when updating the finding resource. This field should
1899
- # not be specified when creating a finding.
1900
- #
1901
- # When updating a finding, an empty mask is treated as updating all mutable
1902
- # fields and replacing source_properties. Individual source_properties can
1903
- # be added/updated by using "source_properties.<property key>" in the field
1904
- # mask.
1905
- # A hash of the same form as `Google::Protobuf::FieldMask`
1906
- # can also be provided.
1907
- # @param options [Google::Gax::CallOptions]
1908
- # Overrides the default settings for this call, e.g, timeout,
1909
- # retries, etc.
1910
- # @yield [result, operation] Access the result along with the RPC operation
1911
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1912
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1913
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1914
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1915
- # @example
1916
- # require "google/cloud/security_center"
1917
- #
1918
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1919
- #
1920
- # # TODO: Initialize `finding`:
1921
- # finding = {}
1922
- # response = security_center_client.update_finding(finding)
1923
-
1924
- def update_finding \
1925
- finding,
1926
- update_mask: nil,
1927
- options: nil,
1928
- &block
1929
- req = {
1930
- finding: finding,
1931
- update_mask: update_mask
1932
- }.delete_if { |_, v| v.nil? }
1933
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateFindingRequest)
1934
- @update_finding.call(req, options, &block)
1935
- end
1936
-
1937
- # Updates a notification config.
1938
- #
1939
- # @param notification_config [Google::Cloud::SecurityCenter::V1::NotificationConfig | Hash]
1940
- # Required. The notification config to update.
1941
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::NotificationConfig`
1942
- # can also be provided.
1943
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1944
- # The FieldMask to use when updating the notification config.
1945
- #
1946
- # If empty all mutable fields will be updated.
1947
- # A hash of the same form as `Google::Protobuf::FieldMask`
1948
- # can also be provided.
1949
- # @param options [Google::Gax::CallOptions]
1950
- # Overrides the default settings for this call, e.g, timeout,
1951
- # retries, etc.
1952
- # @yield [result, operation] Access the result along with the RPC operation
1953
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1954
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1955
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1956
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1957
- # @example
1958
- # require "google/cloud/security_center"
1959
- #
1960
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1961
- #
1962
- # # TODO: Initialize `notification_config`:
1963
- # notification_config = {}
1964
- # response = security_center_client.update_notification_config(notification_config)
1965
-
1966
- def update_notification_config \
1967
- notification_config,
1968
- update_mask: nil,
1969
- options: nil,
1970
- &block
1971
- req = {
1972
- notification_config: notification_config,
1973
- update_mask: update_mask
1974
- }.delete_if { |_, v| v.nil? }
1975
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest)
1976
- @update_notification_config.call(req, options, &block)
1977
- end
1978
-
1979
- # Updates an organization's settings.
1980
- #
1981
- # @param organization_settings [Google::Cloud::SecurityCenter::V1::OrganizationSettings | Hash]
1982
- # Required. The organization settings resource to update.
1983
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::OrganizationSettings`
1984
- # can also be provided.
1985
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1986
- # The FieldMask to use when updating the settings resource.
1987
- #
1988
- # If empty all mutable fields will be updated.
1989
- # A hash of the same form as `Google::Protobuf::FieldMask`
1990
- # can also be provided.
1991
- # @param options [Google::Gax::CallOptions]
1992
- # Overrides the default settings for this call, e.g, timeout,
1993
- # retries, etc.
1994
- # @yield [result, operation] Access the result along with the RPC operation
1995
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1996
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1997
- # @return [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1998
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1999
- # @example
2000
- # require "google/cloud/security_center"
2001
- #
2002
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2003
- #
2004
- # # TODO: Initialize `organization_settings`:
2005
- # organization_settings = {}
2006
- # response = security_center_client.update_organization_settings(organization_settings)
2007
-
2008
- def update_organization_settings \
2009
- organization_settings,
2010
- update_mask: nil,
2011
- options: nil,
2012
- &block
2013
- req = {
2014
- organization_settings: organization_settings,
2015
- update_mask: update_mask
2016
- }.delete_if { |_, v| v.nil? }
2017
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest)
2018
- @update_organization_settings.call(req, options, &block)
2019
- end
2020
-
2021
- # Updates a source.
2022
- #
2023
- # @param source [Google::Cloud::SecurityCenter::V1::Source | Hash]
2024
- # Required. The source resource to update.
2025
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Source`
2026
- # can also be provided.
2027
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2028
- # The FieldMask to use when updating the source resource.
2029
- #
2030
- # If empty all mutable fields will be updated.
2031
- # A hash of the same form as `Google::Protobuf::FieldMask`
2032
- # can also be provided.
2033
- # @param options [Google::Gax::CallOptions]
2034
- # Overrides the default settings for this call, e.g, timeout,
2035
- # retries, etc.
2036
- # @yield [result, operation] Access the result along with the RPC operation
2037
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
2038
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2039
- # @return [Google::Cloud::SecurityCenter::V1::Source]
2040
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2041
- # @example
2042
- # require "google/cloud/security_center"
2043
- #
2044
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2045
- #
2046
- # # TODO: Initialize `source`:
2047
- # source = {}
2048
- # response = security_center_client.update_source(source)
2049
-
2050
- def update_source \
2051
- source,
2052
- update_mask: nil,
2053
- options: nil,
2054
- &block
2055
- req = {
2056
- source: source,
2057
- update_mask: update_mask
2058
- }.delete_if { |_, v| v.nil? }
2059
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateSourceRequest)
2060
- @update_source.call(req, options, &block)
2061
- end
2062
-
2063
- # Updates security marks.
2064
- #
2065
- # @param security_marks [Google::Cloud::SecurityCenter::V1::SecurityMarks | Hash]
2066
- # Required. The security marks resource to update.
2067
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::SecurityMarks`
2068
- # can also be provided.
2069
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2070
- # The FieldMask to use when updating the security marks resource.
2071
- #
2072
- # The field mask must not contain duplicate fields.
2073
- # If empty or set to "marks", all marks will be replaced. Individual
2074
- # marks can be updated using "marks.<mark_key>".
2075
- # A hash of the same form as `Google::Protobuf::FieldMask`
2076
- # can also be provided.
2077
- # @param start_time [Google::Protobuf::Timestamp | Hash]
2078
- # The time at which the updated SecurityMarks take effect.
2079
- # If not set uses current server time. Updates will be applied to the
2080
- # SecurityMarks that are active immediately preceding this time.
2081
- # A hash of the same form as `Google::Protobuf::Timestamp`
2082
- # can also be provided.
2083
- # @param options [Google::Gax::CallOptions]
2084
- # Overrides the default settings for this call, e.g, timeout,
2085
- # retries, etc.
2086
- # @yield [result, operation] Access the result along with the RPC operation
2087
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::SecurityMarks]
2088
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2089
- # @return [Google::Cloud::SecurityCenter::V1::SecurityMarks]
2090
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2091
- # @example
2092
- # require "google/cloud/security_center"
2093
- #
2094
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2095
- #
2096
- # # TODO: Initialize `security_marks`:
2097
- # security_marks = {}
2098
- # response = security_center_client.update_security_marks(security_marks)
2099
-
2100
- def update_security_marks \
2101
- security_marks,
2102
- update_mask: nil,
2103
- start_time: nil,
2104
- options: nil,
2105
- &block
2106
- req = {
2107
- security_marks: security_marks,
2108
- update_mask: update_mask,
2109
- start_time: start_time
2110
- }.delete_if { |_, v| v.nil? }
2111
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest)
2112
- @update_security_marks.call(req, options, &block)
2113
- end
2114
- end
2115
- end
2116
- end
2117
- end
2118
- end