google-cloud-web_risk-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module WebRisk
23
+ module V1
24
+ module WebRiskService
25
+ # Path helper methods for the WebRiskService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Project resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}`
33
+ #
34
+ # @param project [String]
35
+ #
36
+ # @return [String]
37
+ def project_path project:
38
+ "projects/#{project}"
39
+ end
40
+
41
+ extend self
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/web_risk/v1/version"
24
+
25
+ require "google/cloud/web_risk/v1/web_risk_service/credentials"
26
+ require "google/cloud/web_risk/v1/web_risk_service/paths"
27
+ require "google/cloud/web_risk/v1/web_risk_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module WebRisk
32
+ module V1
33
+ ##
34
+ # Web Risk API defines an interface to detect malicious URLs on your
35
+ # website and in client applications.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/web_risk/v1/web_risk_service"
40
+ # client = Google::Cloud::WebRisk::V1::WebRiskService::Client.new
41
+ #
42
+ module WebRiskService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "web_risk_service", "helpers.rb"
50
+ require "google/cloud/web_risk/v1/web_risk_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/web_risk/v1/web_risk_service"
20
+ require "google/cloud/web_risk/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module WebRisk
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/web_risk/v1"
29
+ # client = Google::Cloud::WebRisk::V1::WebRiskService::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,132 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/webrisk/v1/webrisk.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/protobuf/timestamp_pb'
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_file("google/cloud/webrisk/v1/webrisk.proto", :syntax => :proto3) do
13
+ add_message "google.cloud.webrisk.v1.ComputeThreatListDiffRequest" do
14
+ optional :threat_type, :enum, 1, "google.cloud.webrisk.v1.ThreatType"
15
+ optional :version_token, :bytes, 2
16
+ optional :constraints, :message, 3, "google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints"
17
+ end
18
+ add_message "google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints" do
19
+ optional :max_diff_entries, :int32, 1
20
+ optional :max_database_entries, :int32, 2
21
+ repeated :supported_compressions, :enum, 3, "google.cloud.webrisk.v1.CompressionType"
22
+ end
23
+ add_message "google.cloud.webrisk.v1.ComputeThreatListDiffResponse" do
24
+ optional :response_type, :enum, 4, "google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType"
25
+ optional :additions, :message, 5, "google.cloud.webrisk.v1.ThreatEntryAdditions"
26
+ optional :removals, :message, 6, "google.cloud.webrisk.v1.ThreatEntryRemovals"
27
+ optional :new_version_token, :bytes, 7
28
+ optional :checksum, :message, 8, "google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum"
29
+ optional :recommended_next_diff, :message, 2, "google.protobuf.Timestamp"
30
+ end
31
+ add_message "google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum" do
32
+ optional :sha256, :bytes, 1
33
+ end
34
+ add_enum "google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType" do
35
+ value :RESPONSE_TYPE_UNSPECIFIED, 0
36
+ value :DIFF, 1
37
+ value :RESET, 2
38
+ end
39
+ add_message "google.cloud.webrisk.v1.SearchUrisRequest" do
40
+ optional :uri, :string, 1
41
+ repeated :threat_types, :enum, 2, "google.cloud.webrisk.v1.ThreatType"
42
+ end
43
+ add_message "google.cloud.webrisk.v1.SearchUrisResponse" do
44
+ optional :threat, :message, 1, "google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri"
45
+ end
46
+ add_message "google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri" do
47
+ repeated :threat_types, :enum, 1, "google.cloud.webrisk.v1.ThreatType"
48
+ optional :expire_time, :message, 2, "google.protobuf.Timestamp"
49
+ end
50
+ add_message "google.cloud.webrisk.v1.SearchHashesRequest" do
51
+ optional :hash_prefix, :bytes, 1
52
+ repeated :threat_types, :enum, 2, "google.cloud.webrisk.v1.ThreatType"
53
+ end
54
+ add_message "google.cloud.webrisk.v1.SearchHashesResponse" do
55
+ repeated :threats, :message, 1, "google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash"
56
+ optional :negative_expire_time, :message, 2, "google.protobuf.Timestamp"
57
+ end
58
+ add_message "google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash" do
59
+ repeated :threat_types, :enum, 1, "google.cloud.webrisk.v1.ThreatType"
60
+ optional :hash, :bytes, 2
61
+ optional :expire_time, :message, 3, "google.protobuf.Timestamp"
62
+ end
63
+ add_message "google.cloud.webrisk.v1.ThreatEntryAdditions" do
64
+ repeated :raw_hashes, :message, 1, "google.cloud.webrisk.v1.RawHashes"
65
+ optional :rice_hashes, :message, 2, "google.cloud.webrisk.v1.RiceDeltaEncoding"
66
+ end
67
+ add_message "google.cloud.webrisk.v1.ThreatEntryRemovals" do
68
+ optional :raw_indices, :message, 1, "google.cloud.webrisk.v1.RawIndices"
69
+ optional :rice_indices, :message, 2, "google.cloud.webrisk.v1.RiceDeltaEncoding"
70
+ end
71
+ add_message "google.cloud.webrisk.v1.RawIndices" do
72
+ repeated :indices, :int32, 1
73
+ end
74
+ add_message "google.cloud.webrisk.v1.RawHashes" do
75
+ optional :prefix_size, :int32, 1
76
+ optional :raw_hashes, :bytes, 2
77
+ end
78
+ add_message "google.cloud.webrisk.v1.RiceDeltaEncoding" do
79
+ optional :first_value, :int64, 1
80
+ optional :rice_parameter, :int32, 2
81
+ optional :entry_count, :int32, 3
82
+ optional :encoded_data, :bytes, 4
83
+ end
84
+ add_message "google.cloud.webrisk.v1.Submission" do
85
+ optional :uri, :string, 1
86
+ end
87
+ add_message "google.cloud.webrisk.v1.CreateSubmissionRequest" do
88
+ optional :parent, :string, 1
89
+ optional :submission, :message, 2, "google.cloud.webrisk.v1.Submission"
90
+ end
91
+ add_enum "google.cloud.webrisk.v1.ThreatType" do
92
+ value :THREAT_TYPE_UNSPECIFIED, 0
93
+ value :MALWARE, 1
94
+ value :SOCIAL_ENGINEERING, 2
95
+ value :UNWANTED_SOFTWARE, 3
96
+ end
97
+ add_enum "google.cloud.webrisk.v1.CompressionType" do
98
+ value :COMPRESSION_TYPE_UNSPECIFIED, 0
99
+ value :RAW, 1
100
+ value :RICE, 2
101
+ end
102
+ end
103
+ end
104
+
105
+ module Google
106
+ module Cloud
107
+ module WebRisk
108
+ module V1
109
+ ComputeThreatListDiffRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ComputeThreatListDiffRequest").msgclass
110
+ ComputeThreatListDiffRequest::Constraints = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints").msgclass
111
+ ComputeThreatListDiffResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ComputeThreatListDiffResponse").msgclass
112
+ ComputeThreatListDiffResponse::Checksum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum").msgclass
113
+ ComputeThreatListDiffResponse::ResponseType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType").enummodule
114
+ SearchUrisRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchUrisRequest").msgclass
115
+ SearchUrisResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchUrisResponse").msgclass
116
+ SearchUrisResponse::ThreatUri = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri").msgclass
117
+ SearchHashesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchHashesRequest").msgclass
118
+ SearchHashesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchHashesResponse").msgclass
119
+ SearchHashesResponse::ThreatHash = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash").msgclass
120
+ ThreatEntryAdditions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ThreatEntryAdditions").msgclass
121
+ ThreatEntryRemovals = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ThreatEntryRemovals").msgclass
122
+ RawIndices = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.RawIndices").msgclass
123
+ RawHashes = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.RawHashes").msgclass
124
+ RiceDeltaEncoding = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.RiceDeltaEncoding").msgclass
125
+ Submission = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.Submission").msgclass
126
+ CreateSubmissionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.CreateSubmissionRequest").msgclass
127
+ ThreatType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.ThreatType").enummodule
128
+ CompressionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.webrisk.v1.CompressionType").enummodule
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,70 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/webrisk/v1/webrisk.proto for package 'Google.Cloud.WebRisk.V1'
3
+ # Original file comments:
4
+ # Copyright 2020 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/webrisk/v1/webrisk_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module WebRisk
25
+ module V1
26
+ module WebRiskService
27
+ # Web Risk API defines an interface to detect malicious URLs on your
28
+ # website and in client applications.
29
+ class Service
30
+
31
+ include GRPC::GenericService
32
+
33
+ self.marshal_class_method = :encode
34
+ self.unmarshal_class_method = :decode
35
+ self.service_name = 'google.cloud.webrisk.v1.WebRiskService'
36
+
37
+ # Gets the most recent threat list diffs. These diffs should be applied to
38
+ # a local database of hashes to keep it up-to-date. If the local database is
39
+ # empty or excessively out-of-date, a complete snapshot of the database will
40
+ # be returned. This Method only updates a single ThreatList at a time. To
41
+ # update multiple ThreatList databases, this method needs to be called once
42
+ # for each list.
43
+ rpc :ComputeThreatListDiff, Google::Cloud::WebRisk::V1::ComputeThreatListDiffRequest, Google::Cloud::WebRisk::V1::ComputeThreatListDiffResponse
44
+ # This method is used to check whether a URI is on a given threatList.
45
+ # Multiple threatLists may be searched in a single query.
46
+ # The response will list all requested threatLists the URI was found to
47
+ # match. If the URI is not found on any of the requested ThreatList an
48
+ # empty response will be returned.
49
+ rpc :SearchUris, Google::Cloud::WebRisk::V1::SearchUrisRequest, Google::Cloud::WebRisk::V1::SearchUrisResponse
50
+ # Gets the full hashes that match the requested hash prefix.
51
+ # This is used after a hash prefix is looked up in a threatList
52
+ # and there is a match. The client side threatList only holds partial hashes
53
+ # so the client must query this method to determine if there is a full
54
+ # hash match of a threat.
55
+ rpc :SearchHashes, Google::Cloud::WebRisk::V1::SearchHashesRequest, Google::Cloud::WebRisk::V1::SearchHashesResponse
56
+ # Creates a Submission of a URI suspected of containing phishing content to
57
+ # be reviewed. If the result verifies the existence of malicious phishing
58
+ # content, the site will be added to the [Google's Social Engineering
59
+ # lists](https://support.google.com/webmasters/answer/6350487/) in order to
60
+ # protect users that could get exposed to this threat in the future. Only
61
+ # projects with CREATE_SUBMISSION_USERS visibility can use this method.
62
+ rpc :CreateSubmission, Google::Cloud::WebRisk::V1::CreateSubmissionRequest, Google::Cloud::WebRisk::V1::Submission
63
+ end
64
+
65
+ Stub = Service.rpc_stub_class
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/web_risk/v1"
@@ -0,0 +1,4 @@
1
+ # Web Risk V1 Protocol Buffer Documentation
2
+
3
+ These files are for the YARD documentation of the generated protobuf files.
4
+ They are not intended to be required or loaded at runtime.
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Api
22
+ # An indicator of the behavior of a given field (for example, that a field
23
+ # is required in requests, or given as output but ignored as input).
24
+ # This **does not** change the behavior in protocol buffers itself; it only
25
+ # denotes the behavior and may affect how API tooling handles the field.
26
+ #
27
+ # Note: This enum **may** receive new values in the future.
28
+ module FieldBehavior
29
+ # Conventional default for enums. Do not use this.
30
+ FIELD_BEHAVIOR_UNSPECIFIED = 0
31
+
32
+ # Specifically denotes a field as optional.
33
+ # While all fields in protocol buffers are optional, this may be specified
34
+ # for emphasis if appropriate.
35
+ OPTIONAL = 1
36
+
37
+ # Denotes a field as required.
38
+ # This indicates that the field **must** be provided as part of the request,
39
+ # and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
40
+ REQUIRED = 2
41
+
42
+ # Denotes a field as output only.
43
+ # This indicates that the field is provided in responses, but including the
44
+ # field in a request does nothing (the server *must* ignore it and
45
+ # *must not* throw an error as a result of the field's presence).
46
+ OUTPUT_ONLY = 3
47
+
48
+ # Denotes a field as input only.
49
+ # This indicates that the field is provided in requests, and the
50
+ # corresponding field is not included in output.
51
+ INPUT_ONLY = 4
52
+
53
+ # Denotes a field as immutable.
54
+ # This indicates that the field may be set once in a request to create a
55
+ # resource, but may not be changed thereafter.
56
+ IMMUTABLE = 5
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,247 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Api
22
+ # A simple descriptor of a resource type.
23
+ #
24
+ # ResourceDescriptor annotates a resource message (either by means of a
25
+ # protobuf annotation or use in the service config), and associates the
26
+ # resource's schema, the resource type, and the pattern of the resource name.
27
+ #
28
+ # Example:
29
+ #
30
+ # message Topic {
31
+ # // Indicates this message defines a resource schema.
32
+ # // Declares the resource type in the format of {service}/{kind}.
33
+ # // For Kubernetes resources, the format is {api group}/{kind}.
34
+ # option (google.api.resource) = {
35
+ # type: "pubsub.googleapis.com/Topic"
36
+ # name_descriptor: {
37
+ # pattern: "projects/{project}/topics/{topic}"
38
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
39
+ # parent_name_extractor: "projects/{project}"
40
+ # }
41
+ # };
42
+ # }
43
+ #
44
+ # The ResourceDescriptor Yaml config will look like:
45
+ #
46
+ # resources:
47
+ # - type: "pubsub.googleapis.com/Topic"
48
+ # name_descriptor:
49
+ # - pattern: "projects/\\{project}/topics/\\{topic}"
50
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
+ # parent_name_extractor: "projects/\\{project}"
52
+ #
53
+ # Sometimes, resources have multiple patterns, typically because they can
54
+ # live under multiple parents.
55
+ #
56
+ # Example:
57
+ #
58
+ # message LogEntry {
59
+ # option (google.api.resource) = {
60
+ # type: "logging.googleapis.com/LogEntry"
61
+ # name_descriptor: {
62
+ # pattern: "projects/{project}/logs/{log}"
63
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
64
+ # parent_name_extractor: "projects/{project}"
65
+ # }
66
+ # name_descriptor: {
67
+ # pattern: "folders/{folder}/logs/{log}"
68
+ # parent_type: "cloudresourcemanager.googleapis.com/Folder"
69
+ # parent_name_extractor: "folders/{folder}"
70
+ # }
71
+ # name_descriptor: {
72
+ # pattern: "organizations/{organization}/logs/{log}"
73
+ # parent_type: "cloudresourcemanager.googleapis.com/Organization"
74
+ # parent_name_extractor: "organizations/{organization}"
75
+ # }
76
+ # name_descriptor: {
77
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
78
+ # parent_type: "billing.googleapis.com/BillingAccount"
79
+ # parent_name_extractor: "billingAccounts/{billing_account}"
80
+ # }
81
+ # };
82
+ # }
83
+ #
84
+ # The ResourceDescriptor Yaml config will look like:
85
+ #
86
+ # resources:
87
+ # - type: 'logging.googleapis.com/LogEntry'
88
+ # name_descriptor:
89
+ # - pattern: "projects/{project}/logs/{log}"
90
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
91
+ # parent_name_extractor: "projects/{project}"
92
+ # - pattern: "folders/{folder}/logs/{log}"
93
+ # parent_type: "cloudresourcemanager.googleapis.com/Folder"
94
+ # parent_name_extractor: "folders/{folder}"
95
+ # - pattern: "organizations/{organization}/logs/{log}"
96
+ # parent_type: "cloudresourcemanager.googleapis.com/Organization"
97
+ # parent_name_extractor: "organizations/{organization}"
98
+ # - pattern: "billingAccounts/{billing_account}/logs/{log}"
99
+ # parent_type: "billing.googleapis.com/BillingAccount"
100
+ # parent_name_extractor: "billingAccounts/{billing_account}"
101
+ #
102
+ # For flexible resources, the resource name doesn't contain parent names, but
103
+ # the resource itself has parents for policy evaluation.
104
+ #
105
+ # Example:
106
+ #
107
+ # message Shelf {
108
+ # option (google.api.resource) = {
109
+ # type: "library.googleapis.com/Shelf"
110
+ # name_descriptor: {
111
+ # pattern: "shelves/{shelf}"
112
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
113
+ # }
114
+ # name_descriptor: {
115
+ # pattern: "shelves/{shelf}"
116
+ # parent_type: "cloudresourcemanager.googleapis.com/Folder"
117
+ # }
118
+ # };
119
+ # }
120
+ #
121
+ # The ResourceDescriptor Yaml config will look like:
122
+ #
123
+ # resources:
124
+ # - type: 'library.googleapis.com/Shelf'
125
+ # name_descriptor:
126
+ # - pattern: "shelves/{shelf}"
127
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
128
+ # - pattern: "shelves/{shelf}"
129
+ # parent_type: "cloudresourcemanager.googleapis.com/Folder"
130
+ # @!attribute [rw] type
131
+ # @return [String]
132
+ # The resource type. It must be in the format of
133
+ # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be
134
+ # singular and must not include version numbers.
135
+ #
136
+ # Example: `storage.googleapis.com/Bucket`
137
+ #
138
+ # The value of the resource_type_kind must follow the regular expression
139
+ # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
140
+ # should use PascalCase (UpperCamelCase). The maximum number of
141
+ # characters allowed for the `resource_type_kind` is 100.
142
+ # @!attribute [rw] pattern
143
+ # @return [Array<String>]
144
+ # Optional. The relative resource name pattern associated with this resource
145
+ # type. The DNS prefix of the full resource name shouldn't be specified here.
146
+ #
147
+ # The path pattern must follow the syntax, which aligns with HTTP binding
148
+ # syntax:
149
+ #
150
+ # Template = Segment { "/" Segment } ;
151
+ # Segment = LITERAL | Variable ;
152
+ # Variable = "{" LITERAL "}" ;
153
+ #
154
+ # Examples:
155
+ #
156
+ # - "projects/\\{project}/topics/\\{topic}"
157
+ # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}"
158
+ #
159
+ # The components in braces correspond to the IDs for each resource in the
160
+ # hierarchy. It is expected that, if multiple patterns are provided,
161
+ # the same component name (e.g. "project") refers to IDs of the same
162
+ # type of resource.
163
+ # @!attribute [rw] name_field
164
+ # @return [String]
165
+ # Optional. The field on the resource that designates the resource name
166
+ # field. If omitted, this is assumed to be "name".
167
+ # @!attribute [rw] history
168
+ # @return [Google::Api::ResourceDescriptor::History]
169
+ # Optional. The historical or future-looking state of the resource pattern.
170
+ #
171
+ # Example:
172
+ #
173
+ # // The InspectTemplate message originally only supported resource
174
+ # // names with organization, and project was added later.
175
+ # message InspectTemplate {
176
+ # option (google.api.resource) = {
177
+ # type: "dlp.googleapis.com/InspectTemplate"
178
+ # pattern:
179
+ # "organizations/{organization}/inspectTemplates/{inspect_template}"
180
+ # pattern: "projects/{project}/inspectTemplates/{inspect_template}"
181
+ # history: ORIGINALLY_SINGLE_PATTERN
182
+ # };
183
+ # }
184
+ # @!attribute [rw] plural
185
+ # @return [String]
186
+ # The plural name used in the resource name, such as 'projects' for
187
+ # the name of 'projects/\\{project}'. It is the same concept of the `plural`
188
+ # field in k8s CRD spec
189
+ # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
190
+ # @!attribute [rw] singular
191
+ # @return [String]
192
+ # The same concept of the `singular` field in k8s CRD spec
193
+ # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
194
+ # Such as "project" for the `resourcemanager.googleapis.com/Project` type.
195
+ class ResourceDescriptor
196
+ include Google::Protobuf::MessageExts
197
+ extend Google::Protobuf::MessageExts::ClassMethods
198
+
199
+ # A description of the historical or future-looking state of the
200
+ # resource pattern.
201
+ module History
202
+ # The "unset" value.
203
+ HISTORY_UNSPECIFIED = 0
204
+
205
+ # The resource originally had one pattern and launched as such, and
206
+ # additional patterns were added later.
207
+ ORIGINALLY_SINGLE_PATTERN = 1
208
+
209
+ # The resource has one pattern, but the API owner expects to add more
210
+ # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
211
+ # that from being necessary once there are multiple patterns.)
212
+ FUTURE_MULTI_PATTERN = 2
213
+ end
214
+ end
215
+
216
+ # Defines a proto annotation that describes a string field that refers to
217
+ # an API resource.
218
+ # @!attribute [rw] type
219
+ # @return [String]
220
+ # The resource type that the annotated field references.
221
+ #
222
+ # Example:
223
+ #
224
+ # message Subscription {
225
+ # string topic = 2 [(google.api.resource_reference) = {
226
+ # type: "pubsub.googleapis.com/Topic"
227
+ # }];
228
+ # }
229
+ # @!attribute [rw] child_type
230
+ # @return [String]
231
+ # The resource type of a child collection that the annotated field
232
+ # references. This is useful for annotating the `parent` field that
233
+ # doesn't have a fixed resource type.
234
+ #
235
+ # Example:
236
+ #
237
+ # message ListLogEntriesRequest {
238
+ # string parent = 1 [(google.api.resource_reference) = {
239
+ # child_type: "logging.googleapis.com/LogEntry"
240
+ # };
241
+ # }
242
+ class ResourceReference
243
+ include Google::Protobuf::MessageExts
244
+ extend Google::Protobuf::MessageExts::ClassMethods
245
+ end
246
+ end
247
+ end