google-cloud-security_center 0.8.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
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 +62 -112
  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 -2115
  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 -2090
  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,2115 +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
- headers.merge!(metadata) unless metadata.nil?
328
- client_config_file = Pathname.new(__dir__).join(
329
- "security_center_client_config.json"
330
- )
331
- defaults = client_config_file.open do |f|
332
- Google::Gax.construct_settings(
333
- "google.cloud.securitycenter.v1.SecurityCenter",
334
- JSON.parse(f.read),
335
- client_config,
336
- Google::Gax::Grpc::STATUS_CODE_NAMES,
337
- timeout,
338
- page_descriptors: PAGE_DESCRIPTORS,
339
- errors: Google::Gax::Grpc::API_ERRORS,
340
- metadata: headers
341
- )
342
- end
343
-
344
- # Allow overriding the service path/port in subclasses.
345
- service_path = service_address || self.class::SERVICE_ADDRESS
346
- port = service_port || self.class::DEFAULT_SERVICE_PORT
347
- interceptors = self.class::GRPC_INTERCEPTORS
348
- @security_center_stub = Google::Gax::Grpc.create_stub(
349
- service_path,
350
- port,
351
- chan_creds: chan_creds,
352
- channel: channel,
353
- updater_proc: updater_proc,
354
- scopes: scopes,
355
- interceptors: interceptors,
356
- &Google::Cloud::SecurityCenter::V1::SecurityCenter::Stub.method(:new)
357
- )
358
-
359
- @get_iam_policy = Google::Gax.create_api_call(
360
- @security_center_stub.method(:get_iam_policy),
361
- defaults["get_iam_policy"],
362
- exception_transformer: exception_transformer,
363
- params_extractor: proc do |request|
364
- {'resource' => request.resource}
365
- end
366
- )
367
- @group_assets = Google::Gax.create_api_call(
368
- @security_center_stub.method(:group_assets),
369
- defaults["group_assets"],
370
- exception_transformer: exception_transformer,
371
- params_extractor: proc do |request|
372
- {'parent' => request.parent}
373
- end
374
- )
375
- @group_findings = Google::Gax.create_api_call(
376
- @security_center_stub.method(:group_findings),
377
- defaults["group_findings"],
378
- exception_transformer: exception_transformer,
379
- params_extractor: proc do |request|
380
- {'parent' => request.parent}
381
- end
382
- )
383
- @test_iam_permissions = Google::Gax.create_api_call(
384
- @security_center_stub.method(:test_iam_permissions),
385
- defaults["test_iam_permissions"],
386
- exception_transformer: exception_transformer,
387
- params_extractor: proc do |request|
388
- {'resource' => request.resource}
389
- end
390
- )
391
- @create_source = Google::Gax.create_api_call(
392
- @security_center_stub.method(:create_source),
393
- defaults["create_source"],
394
- exception_transformer: exception_transformer,
395
- params_extractor: proc do |request|
396
- {'parent' => request.parent}
397
- end
398
- )
399
- @create_finding = Google::Gax.create_api_call(
400
- @security_center_stub.method(:create_finding),
401
- defaults["create_finding"],
402
- exception_transformer: exception_transformer,
403
- params_extractor: proc do |request|
404
- {'parent' => request.parent}
405
- end
406
- )
407
- @create_notification_config = Google::Gax.create_api_call(
408
- @security_center_stub.method(:create_notification_config),
409
- defaults["create_notification_config"],
410
- exception_transformer: exception_transformer,
411
- params_extractor: proc do |request|
412
- {'parent' => request.parent}
413
- end
414
- )
415
- @delete_notification_config = Google::Gax.create_api_call(
416
- @security_center_stub.method(:delete_notification_config),
417
- defaults["delete_notification_config"],
418
- exception_transformer: exception_transformer,
419
- params_extractor: proc do |request|
420
- {'name' => request.name}
421
- end
422
- )
423
- @get_notification_config = Google::Gax.create_api_call(
424
- @security_center_stub.method(:get_notification_config),
425
- defaults["get_notification_config"],
426
- exception_transformer: exception_transformer,
427
- params_extractor: proc do |request|
428
- {'name' => request.name}
429
- end
430
- )
431
- @get_organization_settings = Google::Gax.create_api_call(
432
- @security_center_stub.method(:get_organization_settings),
433
- defaults["get_organization_settings"],
434
- exception_transformer: exception_transformer,
435
- params_extractor: proc do |request|
436
- {'name' => request.name}
437
- end
438
- )
439
- @get_source = Google::Gax.create_api_call(
440
- @security_center_stub.method(:get_source),
441
- defaults["get_source"],
442
- exception_transformer: exception_transformer,
443
- params_extractor: proc do |request|
444
- {'name' => request.name}
445
- end
446
- )
447
- @list_assets = Google::Gax.create_api_call(
448
- @security_center_stub.method(:list_assets),
449
- defaults["list_assets"],
450
- exception_transformer: exception_transformer,
451
- params_extractor: proc do |request|
452
- {'parent' => request.parent}
453
- end
454
- )
455
- @list_findings = Google::Gax.create_api_call(
456
- @security_center_stub.method(:list_findings),
457
- defaults["list_findings"],
458
- exception_transformer: exception_transformer,
459
- params_extractor: proc do |request|
460
- {'parent' => request.parent}
461
- end
462
- )
463
- @list_notification_configs = Google::Gax.create_api_call(
464
- @security_center_stub.method(:list_notification_configs),
465
- defaults["list_notification_configs"],
466
- exception_transformer: exception_transformer,
467
- params_extractor: proc do |request|
468
- {'parent' => request.parent}
469
- end
470
- )
471
- @list_sources = Google::Gax.create_api_call(
472
- @security_center_stub.method(:list_sources),
473
- defaults["list_sources"],
474
- exception_transformer: exception_transformer,
475
- params_extractor: proc do |request|
476
- {'parent' => request.parent}
477
- end
478
- )
479
- @run_asset_discovery = Google::Gax.create_api_call(
480
- @security_center_stub.method(:run_asset_discovery),
481
- defaults["run_asset_discovery"],
482
- exception_transformer: exception_transformer,
483
- params_extractor: proc do |request|
484
- {'parent' => request.parent}
485
- end
486
- )
487
- @set_finding_state = Google::Gax.create_api_call(
488
- @security_center_stub.method(:set_finding_state),
489
- defaults["set_finding_state"],
490
- exception_transformer: exception_transformer,
491
- params_extractor: proc do |request|
492
- {'name' => request.name}
493
- end
494
- )
495
- @set_iam_policy = Google::Gax.create_api_call(
496
- @security_center_stub.method(:set_iam_policy),
497
- defaults["set_iam_policy"],
498
- exception_transformer: exception_transformer,
499
- params_extractor: proc do |request|
500
- {'resource' => request.resource}
501
- end
502
- )
503
- @update_finding = Google::Gax.create_api_call(
504
- @security_center_stub.method(:update_finding),
505
- defaults["update_finding"],
506
- exception_transformer: exception_transformer,
507
- params_extractor: proc do |request|
508
- {'finding.name' => request.finding.name}
509
- end
510
- )
511
- @update_notification_config = Google::Gax.create_api_call(
512
- @security_center_stub.method(:update_notification_config),
513
- defaults["update_notification_config"],
514
- exception_transformer: exception_transformer,
515
- params_extractor: proc do |request|
516
- {'notification_config.name' => request.notification_config.name}
517
- end
518
- )
519
- @update_organization_settings = Google::Gax.create_api_call(
520
- @security_center_stub.method(:update_organization_settings),
521
- defaults["update_organization_settings"],
522
- exception_transformer: exception_transformer,
523
- params_extractor: proc do |request|
524
- {'organization_settings.name' => request.organization_settings.name}
525
- end
526
- )
527
- @update_source = Google::Gax.create_api_call(
528
- @security_center_stub.method(:update_source),
529
- defaults["update_source"],
530
- exception_transformer: exception_transformer,
531
- params_extractor: proc do |request|
532
- {'source.name' => request.source.name}
533
- end
534
- )
535
- @update_security_marks = Google::Gax.create_api_call(
536
- @security_center_stub.method(:update_security_marks),
537
- defaults["update_security_marks"],
538
- exception_transformer: exception_transformer,
539
- params_extractor: proc do |request|
540
- {'security_marks.name' => request.security_marks.name}
541
- end
542
- )
543
- end
544
-
545
- # Service calls
546
-
547
- # Gets the access control policy on the specified Source.
548
- #
549
- # @param resource [String]
550
- # REQUIRED: The resource for which the policy is being requested.
551
- # See the operation documentation for the appropriate value for this field.
552
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
553
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
554
- # `GetIamPolicy`. This field is only used by Cloud IAM.
555
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
556
- # can also be provided.
557
- # @param options [Google::Gax::CallOptions]
558
- # Overrides the default settings for this call, e.g, timeout,
559
- # retries, etc.
560
- # @yield [result, operation] Access the result along with the RPC operation
561
- # @yieldparam result [Google::Iam::V1::Policy]
562
- # @yieldparam operation [GRPC::ActiveCall::Operation]
563
- # @return [Google::Iam::V1::Policy]
564
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
565
- # @example
566
- # require "google/cloud/security_center"
567
- #
568
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
569
- #
570
- # # TODO: Initialize `resource`:
571
- # resource = ''
572
- # response = security_center_client.get_iam_policy(resource)
573
-
574
- def get_iam_policy \
575
- resource,
576
- options_: nil,
577
- options: nil,
578
- &block
579
- req = {
580
- resource: resource,
581
- options: options_
582
- }.delete_if { |_, v| v.nil? }
583
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
584
- @get_iam_policy.call(req, options, &block)
585
- end
586
-
587
- # Filters an organization's assets and groups them by their specified
588
- # properties.
589
- #
590
- # @param parent [String]
591
- # Required. Name of the organization to groupBy. Its format is
592
- # "organizations/[organization_id]".
593
- # @param group_by [String]
594
- # Required. Expression that defines what assets fields to use for grouping.
595
- # The string value should follow SQL syntax: comma separated list of fields.
596
- # For example:
597
- # "security_center_properties.resource_project,security_center_properties.project".
598
- #
599
- # The following fields are supported when compare_duration is not set:
600
- #
601
- # * security_center_properties.resource_project
602
- # * security_center_properties.resource_project_display_name
603
- # * security_center_properties.resource_type
604
- # * security_center_properties.resource_parent
605
- # * security_center_properties.resource_parent_display_name
606
- #
607
- # The following fields are supported when compare_duration is set:
608
- #
609
- # * security_center_properties.resource_type
610
- # * security_center_properties.resource_project_display_name
611
- # * security_center_properties.resource_parent_display_name
612
- # @param filter [String]
613
- # Expression that defines the filter to apply across assets.
614
- # The expression is a list of zero or more restrictions combined via logical
615
- # operators `AND` and `OR`.
616
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
617
- #
618
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
619
- # character in front of them to indicate negation. The fields map to those
620
- # defined in the Asset resource. Examples include:
621
- #
622
- # * name
623
- # * security_center_properties.resource_name
624
- # * resource_properties.a_property
625
- # * security_marks.marks.marka
626
- #
627
- # The supported operators are:
628
- #
629
- # * `=` for all value types.
630
- # * `>`, `<`, `>=`, `<=` for integer values.
631
- # * `:`, meaning substring matching, for strings.
632
- #
633
- # The supported value types are:
634
- #
635
- # * string literals in quotes.
636
- # * integer literals without quotes.
637
- # * boolean literals `true` and `false` without quotes.
638
- #
639
- # The following field and operator combinations are supported:
640
- #
641
- # * name: `=`
642
- # * update_time: `=`, `>`, `<`, `>=`, `<=`
643
- #
644
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
645
- # Examples:
646
- # "update_time = \"2019-06-10T16:07:18-07:00\""
647
- # "update_time = 1560208038000"
648
- #
649
- # * create_time: `=`, `>`, `<`, `>=`, `<=`
650
- #
651
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
652
- # Examples:
653
- # "create_time = \"2019-06-10T16:07:18-07:00\""
654
- # "create_time = 1560208038000"
655
- #
656
- # * iam_policy.policy_blob: `=`, `:`
657
- # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
658
- # * security_marks.marks: `=`, `:`
659
- # * security_center_properties.resource_name: `=`, `:`
660
- # * security_center_properties.resource_display_name: `=`, `:`
661
- # * security_center_properties.resource_type: `=`, `:`
662
- # * security_center_properties.resource_parent: `=`, `:`
663
- # * security_center_properties.resource_parent_display_name: `=`, `:`
664
- # * security_center_properties.resource_project: `=`, `:`
665
- # * security_center_properties.resource_project_display_name: `=`, `:`
666
- # * security_center_properties.resource_owners: `=`, `:`
667
- #
668
- # For example, `resource_properties.size = 100` is a valid filter string.
669
- # @param compare_duration [Google::Protobuf::Duration | Hash]
670
- # When compare_duration is set, the GroupResult's "state_change" property is
671
- # updated to indicate whether the asset was added, removed, or remained
672
- # present during the compare_duration period of time that precedes the
673
- # read_time. This is the time between (read_time - compare_duration) and
674
- # read_time.
675
- #
676
- # The state change value is derived based on the presence of the asset at the
677
- # two points in time. Intermediate state changes between the two times don't
678
- # affect the result. For example, the results aren't affected if the asset is
679
- # removed and re-created again.
680
- #
681
- # Possible "state_change" values when compare_duration is specified:
682
- #
683
- # * "ADDED": indicates that the asset was not present at the start of
684
- # compare_duration, but present at reference_time.
685
- # * "REMOVED": indicates that the asset was present at the start of
686
- # compare_duration, but not present at reference_time.
687
- # * "ACTIVE": indicates that the asset was present at both the
688
- # start and the end of the time period defined by
689
- # compare_duration and reference_time.
690
- #
691
- # If compare_duration is not specified, then the only possible state_change
692
- # is "UNUSED", which will be the state_change set for all assets present at
693
- # read_time.
694
- #
695
- # If this field is set then `state_change` must be a specified field in
696
- # `group_by`.
697
- # A hash of the same form as `Google::Protobuf::Duration`
698
- # can also be provided.
699
- # @param read_time [Google::Protobuf::Timestamp | Hash]
700
- # Time used as a reference point when filtering assets. The filter is limited
701
- # to assets existing at the supplied time and their values are those at that
702
- # specific time. Absence of this field will default to the API's version of
703
- # NOW.
704
- # A hash of the same form as `Google::Protobuf::Timestamp`
705
- # can also be provided.
706
- # @param page_size [Integer]
707
- # The maximum number of resources contained in the underlying API
708
- # response. If page streaming is performed per-resource, this
709
- # parameter does not affect the return value. If page streaming is
710
- # performed per-page, this determines the maximum number of
711
- # resources in a page.
712
- # @param options [Google::Gax::CallOptions]
713
- # Overrides the default settings for this call, e.g, timeout,
714
- # retries, etc.
715
- # @yield [result, operation] Access the result along with the RPC operation
716
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
717
- # @yieldparam operation [GRPC::ActiveCall::Operation]
718
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
719
- # An enumerable of Google::Cloud::SecurityCenter::V1::GroupResult instances.
720
- # See Google::Gax::PagedEnumerable documentation for other
721
- # operations such as per-page iteration or access to the response
722
- # object.
723
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
724
- # @example
725
- # require "google/cloud/security_center"
726
- #
727
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
728
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
729
- #
730
- # # TODO: Initialize `group_by`:
731
- # group_by = ''
732
- #
733
- # # Iterate over all results.
734
- # security_center_client.group_assets(formatted_parent, group_by).each do |element|
735
- # # Process element.
736
- # end
737
- #
738
- # # Or iterate over results one page at a time.
739
- # security_center_client.group_assets(formatted_parent, group_by).each_page do |page|
740
- # # Process each page at a time.
741
- # page.each do |element|
742
- # # Process element.
743
- # end
744
- # end
745
-
746
- def group_assets \
747
- parent,
748
- group_by,
749
- filter: nil,
750
- compare_duration: nil,
751
- read_time: nil,
752
- page_size: nil,
753
- options: nil,
754
- &block
755
- req = {
756
- parent: parent,
757
- group_by: group_by,
758
- filter: filter,
759
- compare_duration: compare_duration,
760
- read_time: read_time,
761
- page_size: page_size
762
- }.delete_if { |_, v| v.nil? }
763
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GroupAssetsRequest)
764
- @group_assets.call(req, options, &block)
765
- end
766
-
767
- # Filters an organization or source's findings and groups them by their
768
- # specified properties.
769
- #
770
- # To group across all sources provide a `-` as the source id.
771
- # Example: /v1/organizations/{organization_id}/sources/-/findings
772
- #
773
- # @param parent [String]
774
- # Required. Name of the source to groupBy. Its format is
775
- # "organizations/[organization_id]/sources/[source_id]". To groupBy across
776
- # all sources provide a source_id of `-`. For example:
777
- # organizations/{organization_id}/sources/-
778
- # @param group_by [String]
779
- # Required. Expression that defines what assets fields to use for grouping
780
- # (including `state_change`). The string value should follow SQL syntax:
781
- # comma separated list of fields. For example: "parent,resource_name".
782
- #
783
- # The following fields are supported:
784
- #
785
- # * resource_name
786
- # * category
787
- # * state
788
- # * parent
789
- #
790
- # The following fields are supported when compare_duration is set:
791
- #
792
- # * state_change
793
- # @param filter [String]
794
- # Expression that defines the filter to apply across findings.
795
- # The expression is a list of one or more restrictions combined via logical
796
- # operators `AND` and `OR`.
797
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
798
- #
799
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
800
- # character in front of them to indicate negation. Examples include:
801
- #
802
- # * name
803
- # * source_properties.a_property
804
- # * security_marks.marks.marka
805
- #
806
- # The supported operators are:
807
- #
808
- # * `=` for all value types.
809
- # * `>`, `<`, `>=`, `<=` for integer values.
810
- # * `:`, meaning substring matching, for strings.
811
- #
812
- # The supported value types are:
813
- #
814
- # * string literals in quotes.
815
- # * integer literals without quotes.
816
- # * boolean literals `true` and `false` without quotes.
817
- #
818
- # The following field and operator combinations are supported:
819
- #
820
- # * name: `=`
821
- # * parent: `=`, `:`
822
- # * resource_name: `=`, `:`
823
- # * state: `=`, `:`
824
- # * category: `=`, `:`
825
- # * external_uri: `=`, `:`
826
- # * event_time: `=`, `>`, `<`, `>=`, `<=`
827
- #
828
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
829
- # Examples:
830
- # "event_time = \"2019-06-10T16:07:18-07:00\""
831
- # "event_time = 1560208038000"
832
- #
833
- # * security_marks.marks: `=`, `:`
834
- # * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
835
- #
836
- # For example, `source_properties.size = 100` is a valid filter string.
837
- # @param read_time [Google::Protobuf::Timestamp | Hash]
838
- # Time used as a reference point when filtering findings. The filter is
839
- # limited to findings existing at the supplied time and their values are
840
- # those at that specific time. Absence of this field will default to the
841
- # API's version of NOW.
842
- # A hash of the same form as `Google::Protobuf::Timestamp`
843
- # can also be provided.
844
- # @param compare_duration [Google::Protobuf::Duration | Hash]
845
- # When compare_duration is set, the GroupResult's "state_change" attribute is
846
- # updated to indicate whether the finding had its state changed, the
847
- # finding's state remained unchanged, or if the finding was added during the
848
- # compare_duration period of time that precedes the read_time. This is the
849
- # time between (read_time - compare_duration) and read_time.
850
- #
851
- # The state_change value is derived based on the presence and state of the
852
- # finding at the two points in time. Intermediate state changes between the
853
- # two times don't affect the result. For example, the results aren't affected
854
- # if the finding is made inactive and then active again.
855
- #
856
- # Possible "state_change" values when compare_duration is specified:
857
- #
858
- # * "CHANGED": indicates that the finding was present and matched the given
859
- # filter at the start of compare_duration, but changed its
860
- # state at read_time.
861
- # * "UNCHANGED": indicates that the finding was present and matched the given
862
- # filter at the start of compare_duration and did not change
863
- # state at read_time.
864
- # * "ADDED": indicates that the finding did not match the given filter or
865
- # was not present at the start of compare_duration, but was
866
- # present at read_time.
867
- # * "REMOVED": indicates that the finding was present and matched the
868
- # filter at the start of compare_duration, but did not match
869
- # the filter at read_time.
870
- #
871
- # If compare_duration is not specified, then the only possible state_change
872
- # is "UNUSED", which will be the state_change set for all findings present
873
- # at read_time.
874
- #
875
- # If this field is set then `state_change` must be a specified field in
876
- # `group_by`.
877
- # A hash of the same form as `Google::Protobuf::Duration`
878
- # can also be provided.
879
- # @param page_size [Integer]
880
- # The maximum number of resources contained in the underlying API
881
- # response. If page streaming is performed per-resource, this
882
- # parameter does not affect the return value. If page streaming is
883
- # performed per-page, this determines the maximum number of
884
- # resources in a page.
885
- # @param options [Google::Gax::CallOptions]
886
- # Overrides the default settings for this call, e.g, timeout,
887
- # retries, etc.
888
- # @yield [result, operation] Access the result along with the RPC operation
889
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
890
- # @yieldparam operation [GRPC::ActiveCall::Operation]
891
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::GroupResult>]
892
- # An enumerable of Google::Cloud::SecurityCenter::V1::GroupResult instances.
893
- # See Google::Gax::PagedEnumerable documentation for other
894
- # operations such as per-page iteration or access to the response
895
- # object.
896
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
897
- # @example
898
- # require "google/cloud/security_center"
899
- #
900
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
901
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
902
- #
903
- # # TODO: Initialize `group_by`:
904
- # group_by = ''
905
- #
906
- # # Iterate over all results.
907
- # security_center_client.group_findings(formatted_parent, group_by).each do |element|
908
- # # Process element.
909
- # end
910
- #
911
- # # Or iterate over results one page at a time.
912
- # security_center_client.group_findings(formatted_parent, group_by).each_page do |page|
913
- # # Process each page at a time.
914
- # page.each do |element|
915
- # # Process element.
916
- # end
917
- # end
918
-
919
- def group_findings \
920
- parent,
921
- group_by,
922
- filter: nil,
923
- read_time: nil,
924
- compare_duration: nil,
925
- page_size: nil,
926
- options: nil,
927
- &block
928
- req = {
929
- parent: parent,
930
- group_by: group_by,
931
- filter: filter,
932
- read_time: read_time,
933
- compare_duration: compare_duration,
934
- page_size: page_size
935
- }.delete_if { |_, v| v.nil? }
936
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GroupFindingsRequest)
937
- @group_findings.call(req, options, &block)
938
- end
939
-
940
- # Returns the permissions that a caller has on the specified source.
941
- #
942
- # @param resource [String]
943
- # REQUIRED: The resource for which the policy detail is being requested.
944
- # See the operation documentation for the appropriate value for this field.
945
- # @param permissions [Array<String>]
946
- # The set of permissions to check for the `resource`. Permissions with
947
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
948
- # information see
949
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
950
- # @param options [Google::Gax::CallOptions]
951
- # Overrides the default settings for this call, e.g, timeout,
952
- # retries, etc.
953
- # @yield [result, operation] Access the result along with the RPC operation
954
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
955
- # @yieldparam operation [GRPC::ActiveCall::Operation]
956
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
957
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
958
- # @example
959
- # require "google/cloud/security_center"
960
- #
961
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
962
- #
963
- # # TODO: Initialize `resource`:
964
- # resource = ''
965
- #
966
- # # TODO: Initialize `permissions`:
967
- # permissions = []
968
- # response = security_center_client.test_iam_permissions(resource, permissions)
969
-
970
- def test_iam_permissions \
971
- resource,
972
- permissions,
973
- options: nil,
974
- &block
975
- req = {
976
- resource: resource,
977
- permissions: permissions
978
- }.delete_if { |_, v| v.nil? }
979
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
980
- @test_iam_permissions.call(req, options, &block)
981
- end
982
-
983
- # Creates a source.
984
- #
985
- # @param parent [String]
986
- # Required. Resource name of the new source's parent. Its format should be
987
- # "organizations/[organization_id]".
988
- # @param source [Google::Cloud::SecurityCenter::V1::Source | Hash]
989
- # Required. The Source being created, only the display_name and description
990
- # will be used. All other fields will be ignored.
991
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Source`
992
- # can also be provided.
993
- # @param options [Google::Gax::CallOptions]
994
- # Overrides the default settings for this call, e.g, timeout,
995
- # retries, etc.
996
- # @yield [result, operation] Access the result along with the RPC operation
997
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
998
- # @yieldparam operation [GRPC::ActiveCall::Operation]
999
- # @return [Google::Cloud::SecurityCenter::V1::Source]
1000
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1001
- # @example
1002
- # require "google/cloud/security_center"
1003
- #
1004
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1005
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1006
- #
1007
- # # TODO: Initialize `source`:
1008
- # source = {}
1009
- # response = security_center_client.create_source(formatted_parent, source)
1010
-
1011
- def create_source \
1012
- parent,
1013
- source,
1014
- options: nil,
1015
- &block
1016
- req = {
1017
- parent: parent,
1018
- source: source
1019
- }.delete_if { |_, v| v.nil? }
1020
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateSourceRequest)
1021
- @create_source.call(req, options, &block)
1022
- end
1023
-
1024
- # Creates a finding. The corresponding source must exist for finding creation
1025
- # to succeed.
1026
- #
1027
- # @param parent [String]
1028
- # Required. Resource name of the new finding's parent. Its format should be
1029
- # "organizations/[organization_id]/sources/[source_id]".
1030
- # @param finding_id [String]
1031
- # Required. Unique identifier provided by the client within the parent scope.
1032
- # It must be alphanumeric and less than or equal to 32 characters and
1033
- # greater than 0 characters in length.
1034
- # @param finding [Google::Cloud::SecurityCenter::V1::Finding | Hash]
1035
- # Required. The Finding being created. The name and security_marks will be
1036
- # ignored as they are both output only fields on this resource.
1037
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Finding`
1038
- # can also be provided.
1039
- # @param options [Google::Gax::CallOptions]
1040
- # Overrides the default settings for this call, e.g, timeout,
1041
- # retries, etc.
1042
- # @yield [result, operation] Access the result along with the RPC operation
1043
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1044
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1045
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1046
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1047
- # @example
1048
- # require "google/cloud/security_center"
1049
- #
1050
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1051
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1052
- #
1053
- # # TODO: Initialize `finding_id`:
1054
- # finding_id = ''
1055
- #
1056
- # # TODO: Initialize `finding`:
1057
- # finding = {}
1058
- # response = security_center_client.create_finding(formatted_parent, finding_id, finding)
1059
-
1060
- def create_finding \
1061
- parent,
1062
- finding_id,
1063
- finding,
1064
- options: nil,
1065
- &block
1066
- req = {
1067
- parent: parent,
1068
- finding_id: finding_id,
1069
- finding: finding
1070
- }.delete_if { |_, v| v.nil? }
1071
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateFindingRequest)
1072
- @create_finding.call(req, options, &block)
1073
- end
1074
-
1075
- # Creates a notification config.
1076
- #
1077
- # @param parent [String]
1078
- # Required. Resource name of the new notification config's parent. Its format
1079
- # is "organizations/[organization_id]".
1080
- # @param config_id [String]
1081
- # Required.
1082
- # Unique identifier provided by the client within the parent scope.
1083
- # It must be between 1 and 128 characters, and contains alphanumeric
1084
- # characters, underscores or hyphens only.
1085
- # @param notification_config [Google::Cloud::SecurityCenter::V1::NotificationConfig | Hash]
1086
- # Required. The notification config being created. The name and the service
1087
- # account will be ignored as they are both output only fields on this
1088
- # resource.
1089
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::NotificationConfig`
1090
- # can also be provided.
1091
- # @param options [Google::Gax::CallOptions]
1092
- # Overrides the default settings for this call, e.g, timeout,
1093
- # retries, etc.
1094
- # @yield [result, operation] Access the result along with the RPC operation
1095
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1096
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1097
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1098
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1099
- # @example
1100
- # require "google/cloud/security_center"
1101
- #
1102
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1103
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1104
- #
1105
- # # TODO: Initialize `config_id`:
1106
- # config_id = ''
1107
- #
1108
- # # TODO: Initialize `notification_config`:
1109
- # notification_config = {}
1110
- # response = security_center_client.create_notification_config(formatted_parent, config_id, notification_config)
1111
-
1112
- def create_notification_config \
1113
- parent,
1114
- config_id,
1115
- notification_config,
1116
- options: nil,
1117
- &block
1118
- req = {
1119
- parent: parent,
1120
- config_id: config_id,
1121
- notification_config: notification_config
1122
- }.delete_if { |_, v| v.nil? }
1123
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::CreateNotificationConfigRequest)
1124
- @create_notification_config.call(req, options, &block)
1125
- end
1126
-
1127
- # Deletes a notification config.
1128
- #
1129
- # @param name [String]
1130
- # Required. Name of the notification config to delete. Its format is
1131
- # "organizations/[organization_id]/notificationConfigs/[config_id]".
1132
- # @param options [Google::Gax::CallOptions]
1133
- # Overrides the default settings for this call, e.g, timeout,
1134
- # retries, etc.
1135
- # @yield [result, operation] Access the result along with the RPC operation
1136
- # @yieldparam result []
1137
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1138
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1139
- # @example
1140
- # require "google/cloud/security_center"
1141
- #
1142
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1143
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.notification_config_path("[ORGANIZATION]", "[NOTIFICATION_CONFIG]")
1144
- # security_center_client.delete_notification_config(formatted_name)
1145
-
1146
- def delete_notification_config \
1147
- name,
1148
- options: nil,
1149
- &block
1150
- req = {
1151
- name: name
1152
- }.delete_if { |_, v| v.nil? }
1153
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::DeleteNotificationConfigRequest)
1154
- @delete_notification_config.call(req, options, &block)
1155
- nil
1156
- end
1157
-
1158
- # Gets a notification config.
1159
- #
1160
- # @param name [String]
1161
- # Required. Name of the notification config to get. Its format is
1162
- # "organizations/[organization_id]/notificationConfigs/[config_id]".
1163
- # @param options [Google::Gax::CallOptions]
1164
- # Overrides the default settings for this call, e.g, timeout,
1165
- # retries, etc.
1166
- # @yield [result, operation] Access the result along with the RPC operation
1167
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1168
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1169
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1170
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1171
- # @example
1172
- # require "google/cloud/security_center"
1173
- #
1174
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1175
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.notification_config_path("[ORGANIZATION]", "[NOTIFICATION_CONFIG]")
1176
- # response = security_center_client.get_notification_config(formatted_name)
1177
-
1178
- def get_notification_config \
1179
- name,
1180
- options: nil,
1181
- &block
1182
- req = {
1183
- name: name
1184
- }.delete_if { |_, v| v.nil? }
1185
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetNotificationConfigRequest)
1186
- @get_notification_config.call(req, options, &block)
1187
- end
1188
-
1189
- # Gets the settings for an organization.
1190
- #
1191
- # @param name [String]
1192
- # Required. Name of the organization to get organization settings for. Its
1193
- # format is "organizations/[organization_id]/organizationSettings".
1194
- # @param options [Google::Gax::CallOptions]
1195
- # Overrides the default settings for this call, e.g, timeout,
1196
- # retries, etc.
1197
- # @yield [result, operation] Access the result along with the RPC operation
1198
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1199
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1200
- # @return [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1201
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1202
- # @example
1203
- # require "google/cloud/security_center"
1204
- #
1205
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1206
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_settings_path("[ORGANIZATION]")
1207
- # response = security_center_client.get_organization_settings(formatted_name)
1208
-
1209
- def get_organization_settings \
1210
- name,
1211
- options: nil,
1212
- &block
1213
- req = {
1214
- name: name
1215
- }.delete_if { |_, v| v.nil? }
1216
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetOrganizationSettingsRequest)
1217
- @get_organization_settings.call(req, options, &block)
1218
- end
1219
-
1220
- # Gets a source.
1221
- #
1222
- # @param name [String]
1223
- # Required. Relative resource name of the source. Its format is
1224
- # "organizations/[organization_id]/source/[source_id]".
1225
- # @param options [Google::Gax::CallOptions]
1226
- # Overrides the default settings for this call, e.g, timeout,
1227
- # retries, etc.
1228
- # @yield [result, operation] Access the result along with the RPC operation
1229
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
1230
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1231
- # @return [Google::Cloud::SecurityCenter::V1::Source]
1232
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1233
- # @example
1234
- # require "google/cloud/security_center"
1235
- #
1236
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1237
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1238
- # response = security_center_client.get_source(formatted_name)
1239
-
1240
- def get_source \
1241
- name,
1242
- options: nil,
1243
- &block
1244
- req = {
1245
- name: name
1246
- }.delete_if { |_, v| v.nil? }
1247
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::GetSourceRequest)
1248
- @get_source.call(req, options, &block)
1249
- end
1250
-
1251
- # Lists an organization's assets.
1252
- #
1253
- # @param parent [String]
1254
- # Required. Name of the organization assets should belong to. Its format is
1255
- # "organizations/[organization_id]".
1256
- # @param filter [String]
1257
- # Expression that defines the filter to apply across assets.
1258
- # The expression is a list of zero or more restrictions combined via logical
1259
- # operators `AND` and `OR`.
1260
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
1261
- #
1262
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1263
- # character in front of them to indicate negation. The fields map to those
1264
- # defined in the Asset resource. Examples include:
1265
- #
1266
- # * name
1267
- # * security_center_properties.resource_name
1268
- # * resource_properties.a_property
1269
- # * security_marks.marks.marka
1270
- #
1271
- # The supported operators are:
1272
- #
1273
- # * `=` for all value types.
1274
- # * `>`, `<`, `>=`, `<=` for integer values.
1275
- # * `:`, meaning substring matching, for strings.
1276
- #
1277
- # The supported value types are:
1278
- #
1279
- # * string literals in quotes.
1280
- # * integer literals without quotes.
1281
- # * boolean literals `true` and `false` without quotes.
1282
- #
1283
- # The following are the allowed field and operator combinations:
1284
- #
1285
- # * name: `=`
1286
- # * update_time: `=`, `>`, `<`, `>=`, `<=`
1287
- #
1288
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1289
- # Examples:
1290
- # "update_time = \"2019-06-10T16:07:18-07:00\""
1291
- # "update_time = 1560208038000"
1292
- #
1293
- # * create_time: `=`, `>`, `<`, `>=`, `<=`
1294
- #
1295
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1296
- # Examples:
1297
- # "create_time = \"2019-06-10T16:07:18-07:00\""
1298
- # "create_time = 1560208038000"
1299
- #
1300
- # * iam_policy.policy_blob: `=`, `:`
1301
- # * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1302
- # * security_marks.marks: `=`, `:`
1303
- # * security_center_properties.resource_name: `=`, `:`
1304
- # * security_center_properties.resource_display_name: `=`, `:`
1305
- # * security_center_properties.resource_type: `=`, `:`
1306
- # * security_center_properties.resource_parent: `=`, `:`
1307
- # * security_center_properties.resource_parent_display_name: `=`, `:`
1308
- # * security_center_properties.resource_project: `=`, `:`
1309
- # * security_center_properties.resource_project_display_name: `=`, `:`
1310
- # * security_center_properties.resource_owners: `=`, `:`
1311
- #
1312
- # For example, `resource_properties.size = 100` is a valid filter string.
1313
- # @param order_by [String]
1314
- # Expression that defines what fields and order to use for sorting. The
1315
- # string value should follow SQL syntax: comma separated list of fields. For
1316
- # example: "name,resource_properties.a_property". The default sorting order
1317
- # is ascending. To specify descending order for a field, a suffix " desc"
1318
- # should be appended to the field name. For example: "name
1319
- # desc,resource_properties.a_property". Redundant space characters in the
1320
- # syntax are insignificant. "name desc,resource_properties.a_property" and "
1321
- # name desc , resource_properties.a_property " are equivalent.
1322
- #
1323
- # The following fields are supported:
1324
- # name
1325
- # update_time
1326
- # resource_properties
1327
- # security_marks.marks
1328
- # security_center_properties.resource_name
1329
- # security_center_properties.resource_display_name
1330
- # security_center_properties.resource_parent
1331
- # security_center_properties.resource_parent_display_name
1332
- # security_center_properties.resource_project
1333
- # security_center_properties.resource_project_display_name
1334
- # security_center_properties.resource_type
1335
- # @param read_time [Google::Protobuf::Timestamp | Hash]
1336
- # Time used as a reference point when filtering assets. The filter is limited
1337
- # to assets existing at the supplied time and their values are those at that
1338
- # specific time. Absence of this field will default to the API's version of
1339
- # NOW.
1340
- # A hash of the same form as `Google::Protobuf::Timestamp`
1341
- # can also be provided.
1342
- # @param compare_duration [Google::Protobuf::Duration | Hash]
1343
- # When compare_duration is set, the ListAssetsResult's "state_change"
1344
- # attribute is updated to indicate whether the asset was added, removed, or
1345
- # remained present during the compare_duration period of time that precedes
1346
- # the read_time. This is the time between (read_time - compare_duration) and
1347
- # read_time.
1348
- #
1349
- # The state_change value is derived based on the presence of the asset at the
1350
- # two points in time. Intermediate state changes between the two times don't
1351
- # affect the result. For example, the results aren't affected if the asset is
1352
- # removed and re-created again.
1353
- #
1354
- # Possible "state_change" values when compare_duration is specified:
1355
- #
1356
- # * "ADDED": indicates that the asset was not present at the start of
1357
- # compare_duration, but present at read_time.
1358
- # * "REMOVED": indicates that the asset was present at the start of
1359
- # compare_duration, but not present at read_time.
1360
- # * "ACTIVE": indicates that the asset was present at both the
1361
- # start and the end of the time period defined by
1362
- # compare_duration and read_time.
1363
- #
1364
- # If compare_duration is not specified, then the only possible state_change
1365
- # is "UNUSED", which will be the state_change set for all assets present at
1366
- # read_time.
1367
- # A hash of the same form as `Google::Protobuf::Duration`
1368
- # can also be provided.
1369
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
1370
- # Optional. A field mask to specify the ListAssetsResult fields to be listed
1371
- # in the response. An empty field mask will list all fields.
1372
- # A hash of the same form as `Google::Protobuf::FieldMask`
1373
- # can also be provided.
1374
- # @param page_size [Integer]
1375
- # The maximum number of resources contained in the underlying API
1376
- # response. If page streaming is performed per-resource, this
1377
- # parameter does not affect the return value. If page streaming is
1378
- # performed per-page, this determines the maximum number of
1379
- # resources in a page.
1380
- # @param options [Google::Gax::CallOptions]
1381
- # Overrides the default settings for this call, e.g, timeout,
1382
- # retries, etc.
1383
- # @yield [result, operation] Access the result along with the RPC operation
1384
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
1385
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1386
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult>]
1387
- # An enumerable of Google::Cloud::SecurityCenter::V1::ListAssetsResponse::ListAssetsResult instances.
1388
- # See Google::Gax::PagedEnumerable documentation for other
1389
- # operations such as per-page iteration or access to the response
1390
- # object.
1391
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1392
- # @example
1393
- # require "google/cloud/security_center"
1394
- #
1395
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1396
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1397
- #
1398
- # # Iterate over all results.
1399
- # security_center_client.list_assets(formatted_parent).each do |element|
1400
- # # Process element.
1401
- # end
1402
- #
1403
- # # Or iterate over results one page at a time.
1404
- # security_center_client.list_assets(formatted_parent).each_page do |page|
1405
- # # Process each page at a time.
1406
- # page.each do |element|
1407
- # # Process element.
1408
- # end
1409
- # end
1410
-
1411
- def list_assets \
1412
- parent,
1413
- filter: nil,
1414
- order_by: nil,
1415
- read_time: nil,
1416
- compare_duration: nil,
1417
- field_mask: nil,
1418
- page_size: nil,
1419
- options: nil,
1420
- &block
1421
- req = {
1422
- parent: parent,
1423
- filter: filter,
1424
- order_by: order_by,
1425
- read_time: read_time,
1426
- compare_duration: compare_duration,
1427
- field_mask: field_mask,
1428
- page_size: page_size
1429
- }.delete_if { |_, v| v.nil? }
1430
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListAssetsRequest)
1431
- @list_assets.call(req, options, &block)
1432
- end
1433
-
1434
- # Lists an organization or source's findings.
1435
- #
1436
- # To list across all sources provide a `-` as the source id.
1437
- # Example: /v1/organizations/{organization_id}/sources/-/findings
1438
- #
1439
- # @param parent [String]
1440
- # Required. Name of the source the findings belong to. Its format is
1441
- # "organizations/[organization_id]/sources/[source_id]". To list across all
1442
- # sources provide a source_id of `-`. For example:
1443
- # organizations/{organization_id}/sources/-
1444
- # @param filter [String]
1445
- # Expression that defines the filter to apply across findings.
1446
- # The expression is a list of one or more restrictions combined via logical
1447
- # operators `AND` and `OR`.
1448
- # Parentheses are supported, and `OR` has higher precedence than `AND`.
1449
- #
1450
- # Restrictions have the form `<field> <operator> <value>` and may have a `-`
1451
- # character in front of them to indicate negation. Examples include:
1452
- #
1453
- # * name
1454
- # * source_properties.a_property
1455
- # * security_marks.marks.marka
1456
- #
1457
- # The supported operators are:
1458
- #
1459
- # * `=` for all value types.
1460
- # * `>`, `<`, `>=`, `<=` for integer values.
1461
- # * `:`, meaning substring matching, for strings.
1462
- #
1463
- # The supported value types are:
1464
- #
1465
- # * string literals in quotes.
1466
- # * integer literals without quotes.
1467
- # * boolean literals `true` and `false` without quotes.
1468
- #
1469
- # The following field and operator combinations are supported:
1470
- #
1471
- # name: `=`
1472
- # parent: `=`, `:`
1473
- # resource_name: `=`, `:`
1474
- # state: `=`, `:`
1475
- # category: `=`, `:`
1476
- # external_uri: `=`, `:`
1477
- # event_time: `=`, `>`, `<`, `>=`, `<=`
1478
- #
1479
- # Usage: This should be milliseconds since epoch or an RFC3339 string.
1480
- # Examples:
1481
- # "event_time = \"2019-06-10T16:07:18-07:00\""
1482
- # "event_time = 1560208038000"
1483
- #
1484
- # security_marks.marks: `=`, `:`
1485
- # source_properties: `=`, `:`, `>`, `<`, `>=`, `<=`
1486
- #
1487
- # For example, `source_properties.size = 100` is a valid filter string.
1488
- # @param order_by [String]
1489
- # Expression that defines what fields and order to use for sorting. The
1490
- # string value should follow SQL syntax: comma separated list of fields. For
1491
- # example: "name,resource_properties.a_property". The default sorting order
1492
- # is ascending. To specify descending order for a field, a suffix " desc"
1493
- # should be appended to the field name. For example: "name
1494
- # desc,source_properties.a_property". Redundant space characters in the
1495
- # syntax are insignificant. "name desc,source_properties.a_property" and "
1496
- # name desc , source_properties.a_property " are equivalent.
1497
- #
1498
- # The following fields are supported:
1499
- # name
1500
- # parent
1501
- # state
1502
- # category
1503
- # resource_name
1504
- # event_time
1505
- # source_properties
1506
- # security_marks.marks
1507
- # @param read_time [Google::Protobuf::Timestamp | Hash]
1508
- # Time used as a reference point when filtering findings. The filter is
1509
- # limited to findings existing at the supplied time and their values are
1510
- # those at that specific time. Absence of this field will default to the
1511
- # API's version of NOW.
1512
- # A hash of the same form as `Google::Protobuf::Timestamp`
1513
- # can also be provided.
1514
- # @param compare_duration [Google::Protobuf::Duration | Hash]
1515
- # When compare_duration is set, the ListFindingsResult's "state_change"
1516
- # attribute is updated to indicate whether the finding had its state changed,
1517
- # the finding's state remained unchanged, or if the finding was added in any
1518
- # state during the compare_duration period of time that precedes the
1519
- # read_time. This is the time between (read_time - compare_duration) and
1520
- # read_time.
1521
- #
1522
- # The state_change value is derived based on the presence and state of the
1523
- # finding at the two points in time. Intermediate state changes between the
1524
- # two times don't affect the result. For example, the results aren't affected
1525
- # if the finding is made inactive and then active again.
1526
- #
1527
- # Possible "state_change" values when compare_duration is specified:
1528
- #
1529
- # * "CHANGED": indicates that the finding was present and matched the given
1530
- # filter at the start of compare_duration, but changed its
1531
- # state at read_time.
1532
- # * "UNCHANGED": indicates that the finding was present and matched the given
1533
- # filter at the start of compare_duration and did not change
1534
- # state at read_time.
1535
- # * "ADDED": indicates that the finding did not match the given filter or
1536
- # was not present at the start of compare_duration, but was
1537
- # present at read_time.
1538
- # * "REMOVED": indicates that the finding was present and matched the
1539
- # filter at the start of compare_duration, but did not match
1540
- # the filter at read_time.
1541
- #
1542
- # If compare_duration is not specified, then the only possible state_change
1543
- # is "UNUSED", which will be the state_change set for all findings present at
1544
- # read_time.
1545
- # A hash of the same form as `Google::Protobuf::Duration`
1546
- # can also be provided.
1547
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
1548
- # Optional. A field mask to specify the Finding fields to be listed in the
1549
- # response. An empty field mask will list all fields.
1550
- # A hash of the same form as `Google::Protobuf::FieldMask`
1551
- # can also be provided.
1552
- # @param page_size [Integer]
1553
- # The maximum number of resources contained in the underlying API
1554
- # response. If page streaming is performed per-resource, this
1555
- # parameter does not affect the return value. If page streaming is
1556
- # performed per-page, this determines the maximum number of
1557
- # resources in a page.
1558
- # @param options [Google::Gax::CallOptions]
1559
- # Overrides the default settings for this call, e.g, timeout,
1560
- # retries, etc.
1561
- # @yield [result, operation] Access the result along with the RPC operation
1562
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
1563
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1564
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult>]
1565
- # An enumerable of Google::Cloud::SecurityCenter::V1::ListFindingsResponse::ListFindingsResult instances.
1566
- # See Google::Gax::PagedEnumerable documentation for other
1567
- # operations such as per-page iteration or access to the response
1568
- # object.
1569
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1570
- # @example
1571
- # require "google/cloud/security_center"
1572
- #
1573
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1574
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.source_path("[ORGANIZATION]", "[SOURCE]")
1575
- #
1576
- # # Iterate over all results.
1577
- # security_center_client.list_findings(formatted_parent).each do |element|
1578
- # # Process element.
1579
- # end
1580
- #
1581
- # # Or iterate over results one page at a time.
1582
- # security_center_client.list_findings(formatted_parent).each_page do |page|
1583
- # # Process each page at a time.
1584
- # page.each do |element|
1585
- # # Process element.
1586
- # end
1587
- # end
1588
-
1589
- def list_findings \
1590
- parent,
1591
- filter: nil,
1592
- order_by: nil,
1593
- read_time: nil,
1594
- compare_duration: nil,
1595
- field_mask: nil,
1596
- page_size: nil,
1597
- options: nil,
1598
- &block
1599
- req = {
1600
- parent: parent,
1601
- filter: filter,
1602
- order_by: order_by,
1603
- read_time: read_time,
1604
- compare_duration: compare_duration,
1605
- field_mask: field_mask,
1606
- page_size: page_size
1607
- }.delete_if { |_, v| v.nil? }
1608
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListFindingsRequest)
1609
- @list_findings.call(req, options, &block)
1610
- end
1611
-
1612
- # Lists notification configs.
1613
- #
1614
- # @param parent [String]
1615
- # Required. Name of the organization to list notification configs.
1616
- # Its format is "organizations/[organization_id]".
1617
- # @param page_size [Integer]
1618
- # The maximum number of resources contained in the underlying API
1619
- # response. If page streaming is performed per-resource, this
1620
- # parameter does not affect the return value. If page streaming is
1621
- # performed per-page, this determines the maximum number of
1622
- # resources in a page.
1623
- # @param options [Google::Gax::CallOptions]
1624
- # Overrides the default settings for this call, e.g, timeout,
1625
- # retries, etc.
1626
- # @yield [result, operation] Access the result along with the RPC operation
1627
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
1628
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1629
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::NotificationConfig>]
1630
- # An enumerable of Google::Cloud::SecurityCenter::V1::NotificationConfig instances.
1631
- # See Google::Gax::PagedEnumerable documentation for other
1632
- # operations such as per-page iteration or access to the response
1633
- # object.
1634
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1635
- # @example
1636
- # require "google/cloud/security_center"
1637
- #
1638
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1639
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1640
- #
1641
- # # Iterate over all results.
1642
- # security_center_client.list_notification_configs(formatted_parent).each do |element|
1643
- # # Process element.
1644
- # end
1645
- #
1646
- # # Or iterate over results one page at a time.
1647
- # security_center_client.list_notification_configs(formatted_parent).each_page do |page|
1648
- # # Process each page at a time.
1649
- # page.each do |element|
1650
- # # Process element.
1651
- # end
1652
- # end
1653
-
1654
- def list_notification_configs \
1655
- parent,
1656
- page_size: nil,
1657
- options: nil,
1658
- &block
1659
- req = {
1660
- parent: parent,
1661
- page_size: page_size
1662
- }.delete_if { |_, v| v.nil? }
1663
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListNotificationConfigsRequest)
1664
- @list_notification_configs.call(req, options, &block)
1665
- end
1666
-
1667
- # Lists all sources belonging to an organization.
1668
- #
1669
- # @param parent [String]
1670
- # Required. Resource name of the parent of sources to list. Its format should
1671
- # be "organizations/[organization_id]".
1672
- # @param page_size [Integer]
1673
- # The maximum number of resources contained in the underlying API
1674
- # response. If page streaming is performed per-resource, this
1675
- # parameter does not affect the return value. If page streaming is
1676
- # performed per-page, this determines the maximum number of
1677
- # resources in a page.
1678
- # @param options [Google::Gax::CallOptions]
1679
- # Overrides the default settings for this call, e.g, timeout,
1680
- # retries, etc.
1681
- # @yield [result, operation] Access the result along with the RPC operation
1682
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
1683
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1684
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::SecurityCenter::V1::Source>]
1685
- # An enumerable of Google::Cloud::SecurityCenter::V1::Source instances.
1686
- # See Google::Gax::PagedEnumerable documentation for other
1687
- # operations such as per-page iteration or access to the response
1688
- # object.
1689
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1690
- # @example
1691
- # require "google/cloud/security_center"
1692
- #
1693
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1694
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1695
- #
1696
- # # Iterate over all results.
1697
- # security_center_client.list_sources(formatted_parent).each do |element|
1698
- # # Process element.
1699
- # end
1700
- #
1701
- # # Or iterate over results one page at a time.
1702
- # security_center_client.list_sources(formatted_parent).each_page do |page|
1703
- # # Process each page at a time.
1704
- # page.each do |element|
1705
- # # Process element.
1706
- # end
1707
- # end
1708
-
1709
- def list_sources \
1710
- parent,
1711
- page_size: nil,
1712
- options: nil,
1713
- &block
1714
- req = {
1715
- parent: parent,
1716
- page_size: page_size
1717
- }.delete_if { |_, v| v.nil? }
1718
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::ListSourcesRequest)
1719
- @list_sources.call(req, options, &block)
1720
- end
1721
-
1722
- # Runs asset discovery. The discovery is tracked with a long-running
1723
- # operation.
1724
- #
1725
- # This API can only be called with limited frequency for an organization. If
1726
- # it is called too frequently the caller will receive a TOO_MANY_REQUESTS
1727
- # error.
1728
- #
1729
- # @param parent [String]
1730
- # Required. Name of the organization to run asset discovery for. Its format
1731
- # is "organizations/[organization_id]".
1732
- # @param options [Google::Gax::CallOptions]
1733
- # Overrides the default settings for this call, e.g, timeout,
1734
- # retries, etc.
1735
- # @return [Google::Gax::Operation]
1736
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1737
- # @example
1738
- # require "google/cloud/security_center"
1739
- #
1740
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1741
- # formatted_parent = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.organization_path("[ORGANIZATION]")
1742
- #
1743
- # # Register a callback during the method call.
1744
- # operation = security_center_client.run_asset_discovery(formatted_parent) do |op|
1745
- # raise op.results.message if op.error?
1746
- # op_results = op.results
1747
- # # Process the results.
1748
- #
1749
- # metadata = op.metadata
1750
- # # Process the metadata.
1751
- # end
1752
- #
1753
- # # Or use the return value to register a callback.
1754
- # operation.on_done do |op|
1755
- # raise op.results.message if op.error?
1756
- # op_results = op.results
1757
- # # Process the results.
1758
- #
1759
- # metadata = op.metadata
1760
- # # Process the metadata.
1761
- # end
1762
- #
1763
- # # Manually reload the operation.
1764
- # operation.reload!
1765
- #
1766
- # # Or block until the operation completes, triggering callbacks on
1767
- # # completion.
1768
- # operation.wait_until_done!
1769
-
1770
- def run_asset_discovery \
1771
- parent,
1772
- options: nil
1773
- req = {
1774
- parent: parent
1775
- }.delete_if { |_, v| v.nil? }
1776
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryRequest)
1777
- operation = Google::Gax::Operation.new(
1778
- @run_asset_discovery.call(req, options),
1779
- @operations_client,
1780
- Google::Cloud::SecurityCenter::V1::RunAssetDiscoveryResponse,
1781
- Google::Protobuf::Empty,
1782
- call_options: options
1783
- )
1784
- operation.on_done { |operation| yield(operation) } if block_given?
1785
- operation
1786
- end
1787
-
1788
- # Updates the state of a finding.
1789
- #
1790
- # @param name [String]
1791
- # Required. The relative resource name of the finding. See:
1792
- # https://cloud.google.com/apis/design/resource_names#relative_resource_name
1793
- # Example:
1794
- # "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}".
1795
- # @param state [Google::Cloud::SecurityCenter::V1::Finding::State]
1796
- # Required. The desired State of the finding.
1797
- # @param start_time [Google::Protobuf::Timestamp | Hash]
1798
- # Required. The time at which the updated state takes effect.
1799
- # A hash of the same form as `Google::Protobuf::Timestamp`
1800
- # can also be provided.
1801
- # @param options [Google::Gax::CallOptions]
1802
- # Overrides the default settings for this call, e.g, timeout,
1803
- # retries, etc.
1804
- # @yield [result, operation] Access the result along with the RPC operation
1805
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1806
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1807
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1808
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1809
- # @example
1810
- # require "google/cloud/security_center"
1811
- #
1812
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1813
- # formatted_name = Google::Cloud::SecurityCenter::V1::SecurityCenterClient.finding_path("[ORGANIZATION]", "[SOURCE]", "[FINDING]")
1814
- #
1815
- # # TODO: Initialize `state`:
1816
- # state = :STATE_UNSPECIFIED
1817
- #
1818
- # # TODO: Initialize `start_time`:
1819
- # start_time = {}
1820
- # response = security_center_client.set_finding_state(formatted_name, state, start_time)
1821
-
1822
- def set_finding_state \
1823
- name,
1824
- state,
1825
- start_time,
1826
- options: nil,
1827
- &block
1828
- req = {
1829
- name: name,
1830
- state: state,
1831
- start_time: start_time
1832
- }.delete_if { |_, v| v.nil? }
1833
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::SetFindingStateRequest)
1834
- @set_finding_state.call(req, options, &block)
1835
- end
1836
-
1837
- # Sets the access control policy on the specified Source.
1838
- #
1839
- # @param resource [String]
1840
- # REQUIRED: The resource for which the policy is being specified.
1841
- # See the operation documentation for the appropriate value for this field.
1842
- # @param policy [Google::Iam::V1::Policy | Hash]
1843
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
1844
- # the policy is limited to a few 10s of KB. An empty policy is a
1845
- # valid policy but certain Cloud Platform services (such as Projects)
1846
- # might reject them.
1847
- # A hash of the same form as `Google::Iam::V1::Policy`
1848
- # can also be provided.
1849
- # @param options [Google::Gax::CallOptions]
1850
- # Overrides the default settings for this call, e.g, timeout,
1851
- # retries, etc.
1852
- # @yield [result, operation] Access the result along with the RPC operation
1853
- # @yieldparam result [Google::Iam::V1::Policy]
1854
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1855
- # @return [Google::Iam::V1::Policy]
1856
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1857
- # @example
1858
- # require "google/cloud/security_center"
1859
- #
1860
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1861
- #
1862
- # # TODO: Initialize `resource`:
1863
- # resource = ''
1864
- #
1865
- # # TODO: Initialize `policy`:
1866
- # policy = {}
1867
- # response = security_center_client.set_iam_policy(resource, policy)
1868
-
1869
- def set_iam_policy \
1870
- resource,
1871
- policy,
1872
- options: nil,
1873
- &block
1874
- req = {
1875
- resource: resource,
1876
- policy: policy
1877
- }.delete_if { |_, v| v.nil? }
1878
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
1879
- @set_iam_policy.call(req, options, &block)
1880
- end
1881
-
1882
- # Creates or updates a finding. The corresponding source must exist for a
1883
- # finding creation to succeed.
1884
- #
1885
- # @param finding [Google::Cloud::SecurityCenter::V1::Finding | Hash]
1886
- # Required. The finding resource to update or create if it does not already
1887
- # exist. parent, security_marks, and update_time will be ignored.
1888
- #
1889
- # In the case of creation, the finding id portion of the name must be
1890
- # alphanumeric and less than or equal to 32 characters and greater than 0
1891
- # characters in length.
1892
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Finding`
1893
- # can also be provided.
1894
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1895
- # The FieldMask to use when updating the finding resource. This field should
1896
- # not be specified when creating a finding.
1897
- #
1898
- # When updating a finding, an empty mask is treated as updating all mutable
1899
- # fields and replacing source_properties. Individual source_properties can
1900
- # be added/updated by using "source_properties.<property key>" in the field
1901
- # mask.
1902
- # A hash of the same form as `Google::Protobuf::FieldMask`
1903
- # can also be provided.
1904
- # @param options [Google::Gax::CallOptions]
1905
- # Overrides the default settings for this call, e.g, timeout,
1906
- # retries, etc.
1907
- # @yield [result, operation] Access the result along with the RPC operation
1908
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Finding]
1909
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1910
- # @return [Google::Cloud::SecurityCenter::V1::Finding]
1911
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1912
- # @example
1913
- # require "google/cloud/security_center"
1914
- #
1915
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1916
- #
1917
- # # TODO: Initialize `finding`:
1918
- # finding = {}
1919
- # response = security_center_client.update_finding(finding)
1920
-
1921
- def update_finding \
1922
- finding,
1923
- update_mask: nil,
1924
- options: nil,
1925
- &block
1926
- req = {
1927
- finding: finding,
1928
- update_mask: update_mask
1929
- }.delete_if { |_, v| v.nil? }
1930
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateFindingRequest)
1931
- @update_finding.call(req, options, &block)
1932
- end
1933
-
1934
- # Updates a notification config.
1935
- #
1936
- # @param notification_config [Google::Cloud::SecurityCenter::V1::NotificationConfig | Hash]
1937
- # Required. The notification config to update.
1938
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::NotificationConfig`
1939
- # can also be provided.
1940
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1941
- # The FieldMask to use when updating the notification config.
1942
- #
1943
- # If empty all mutable fields will be updated.
1944
- # A hash of the same form as `Google::Protobuf::FieldMask`
1945
- # can also be provided.
1946
- # @param options [Google::Gax::CallOptions]
1947
- # Overrides the default settings for this call, e.g, timeout,
1948
- # retries, etc.
1949
- # @yield [result, operation] Access the result along with the RPC operation
1950
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1951
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1952
- # @return [Google::Cloud::SecurityCenter::V1::NotificationConfig]
1953
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1954
- # @example
1955
- # require "google/cloud/security_center"
1956
- #
1957
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
1958
- #
1959
- # # TODO: Initialize `notification_config`:
1960
- # notification_config = {}
1961
- # response = security_center_client.update_notification_config(notification_config)
1962
-
1963
- def update_notification_config \
1964
- notification_config,
1965
- update_mask: nil,
1966
- options: nil,
1967
- &block
1968
- req = {
1969
- notification_config: notification_config,
1970
- update_mask: update_mask
1971
- }.delete_if { |_, v| v.nil? }
1972
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateNotificationConfigRequest)
1973
- @update_notification_config.call(req, options, &block)
1974
- end
1975
-
1976
- # Updates an organization's settings.
1977
- #
1978
- # @param organization_settings [Google::Cloud::SecurityCenter::V1::OrganizationSettings | Hash]
1979
- # Required. The organization settings resource to update.
1980
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::OrganizationSettings`
1981
- # can also be provided.
1982
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1983
- # The FieldMask to use when updating the settings resource.
1984
- #
1985
- # If empty all mutable fields will be updated.
1986
- # A hash of the same form as `Google::Protobuf::FieldMask`
1987
- # can also be provided.
1988
- # @param options [Google::Gax::CallOptions]
1989
- # Overrides the default settings for this call, e.g, timeout,
1990
- # retries, etc.
1991
- # @yield [result, operation] Access the result along with the RPC operation
1992
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1993
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1994
- # @return [Google::Cloud::SecurityCenter::V1::OrganizationSettings]
1995
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1996
- # @example
1997
- # require "google/cloud/security_center"
1998
- #
1999
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2000
- #
2001
- # # TODO: Initialize `organization_settings`:
2002
- # organization_settings = {}
2003
- # response = security_center_client.update_organization_settings(organization_settings)
2004
-
2005
- def update_organization_settings \
2006
- organization_settings,
2007
- update_mask: nil,
2008
- options: nil,
2009
- &block
2010
- req = {
2011
- organization_settings: organization_settings,
2012
- update_mask: update_mask
2013
- }.delete_if { |_, v| v.nil? }
2014
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateOrganizationSettingsRequest)
2015
- @update_organization_settings.call(req, options, &block)
2016
- end
2017
-
2018
- # Updates a source.
2019
- #
2020
- # @param source [Google::Cloud::SecurityCenter::V1::Source | Hash]
2021
- # Required. The source resource to update.
2022
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::Source`
2023
- # can also be provided.
2024
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2025
- # The FieldMask to use when updating the source resource.
2026
- #
2027
- # If empty all mutable fields will be updated.
2028
- # A hash of the same form as `Google::Protobuf::FieldMask`
2029
- # can also be provided.
2030
- # @param options [Google::Gax::CallOptions]
2031
- # Overrides the default settings for this call, e.g, timeout,
2032
- # retries, etc.
2033
- # @yield [result, operation] Access the result along with the RPC operation
2034
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::Source]
2035
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2036
- # @return [Google::Cloud::SecurityCenter::V1::Source]
2037
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2038
- # @example
2039
- # require "google/cloud/security_center"
2040
- #
2041
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2042
- #
2043
- # # TODO: Initialize `source`:
2044
- # source = {}
2045
- # response = security_center_client.update_source(source)
2046
-
2047
- def update_source \
2048
- source,
2049
- update_mask: nil,
2050
- options: nil,
2051
- &block
2052
- req = {
2053
- source: source,
2054
- update_mask: update_mask
2055
- }.delete_if { |_, v| v.nil? }
2056
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateSourceRequest)
2057
- @update_source.call(req, options, &block)
2058
- end
2059
-
2060
- # Updates security marks.
2061
- #
2062
- # @param security_marks [Google::Cloud::SecurityCenter::V1::SecurityMarks | Hash]
2063
- # Required. The security marks resource to update.
2064
- # A hash of the same form as `Google::Cloud::SecurityCenter::V1::SecurityMarks`
2065
- # can also be provided.
2066
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2067
- # The FieldMask to use when updating the security marks resource.
2068
- #
2069
- # The field mask must not contain duplicate fields.
2070
- # If empty or set to "marks", all marks will be replaced. Individual
2071
- # marks can be updated using "marks.<mark_key>".
2072
- # A hash of the same form as `Google::Protobuf::FieldMask`
2073
- # can also be provided.
2074
- # @param start_time [Google::Protobuf::Timestamp | Hash]
2075
- # The time at which the updated SecurityMarks take effect.
2076
- # If not set uses current server time. Updates will be applied to the
2077
- # SecurityMarks that are active immediately preceding this time.
2078
- # A hash of the same form as `Google::Protobuf::Timestamp`
2079
- # can also be provided.
2080
- # @param options [Google::Gax::CallOptions]
2081
- # Overrides the default settings for this call, e.g, timeout,
2082
- # retries, etc.
2083
- # @yield [result, operation] Access the result along with the RPC operation
2084
- # @yieldparam result [Google::Cloud::SecurityCenter::V1::SecurityMarks]
2085
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2086
- # @return [Google::Cloud::SecurityCenter::V1::SecurityMarks]
2087
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2088
- # @example
2089
- # require "google/cloud/security_center"
2090
- #
2091
- # security_center_client = Google::Cloud::SecurityCenter.new(version: :v1)
2092
- #
2093
- # # TODO: Initialize `security_marks`:
2094
- # security_marks = {}
2095
- # response = security_center_client.update_security_marks(security_marks)
2096
-
2097
- def update_security_marks \
2098
- security_marks,
2099
- update_mask: nil,
2100
- start_time: nil,
2101
- options: nil,
2102
- &block
2103
- req = {
2104
- security_marks: security_marks,
2105
- update_mask: update_mask,
2106
- start_time: start_time
2107
- }.delete_if { |_, v| v.nil? }
2108
- req = Google::Gax::to_proto(req, Google::Cloud::SecurityCenter::V1::UpdateSecurityMarksRequest)
2109
- @update_security_marks.call(req, options, &block)
2110
- end
2111
- end
2112
- end
2113
- end
2114
- end
2115
- end