google-cloud-security_center 0.9.0 → 1.1.2

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