cerbos 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09d04980a1c08690efeeac6d04608e47e18def9b0f2ab6a5c256b4b22576464d'
4
- data.tar.gz: 61968be4473d1a480979d9e2d2af05f0911f1d8b4a8c90947d8dce72910565f7
3
+ metadata.gz: d1ba4a17419c03f18f05118b26ae2e829d3d2fbeb7548fea051604e3e5e99e42
4
+ data.tar.gz: 73cf8dbb7882ff2cc5fdf658670e3cf6783a480cb71d3eeb634c8f5b499dc789
5
5
  SHA512:
6
- metadata.gz: 788ca1b6ff6c4e3a1ea71c791fef64f5802a89423d21dba5da7f91f7fc697ff91f1aa7ebcedab4d4bde807c531b3b13b4ac5e95a53b93d76c79077e214ecd54b
7
- data.tar.gz: 2115919d8cb958b0c347c09710d780d7748fec5933f65f4e91d2af7c937ec0e151ad7cfa808526213a788839ea8360fcfa153b94b9574d9ce6facabdca56fab1
6
+ metadata.gz: 96a39b78eb78562136a31c343e37e6c4b570d04b9db4ba1817915b61f32047c24b32a34d3e24d770a15175d85254979c7baa7ec5fff012c59dd77b4fe2f872da
7
+ data.tar.gz: b68d5d6670f99314af88087b9a1b225e8fc35c9d0f788d8c17edaf4fc06fcf312cfa651a977210a33bc8e320d0493a1e998597f2fec58bdecee527e92fc379f8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  No notable changes.
4
4
 
5
+ ## [0.9.0] - 2024-06-10
6
+
7
+ ### Changed
8
+
9
+ - Use `attr` for principal and resource attributes ([#157](https://github.com/cerbos/cerbos-sdk-ruby/pull/157))
10
+
11
+ This makes the API consistent with policy expressions.
12
+ `attributes` is still supported for backwards compatibility, but is now deprecated.
13
+
14
+ - Increased [`google-protobuf`] version requirement to 3.21.12+ to avoid [failure to load `protovalidate` extension field descriptors](https://github.com/protocolbuffers/upb/pull/1034) ([#159](https://github.com/cerbos/cerbos-sdk-ruby/pull/159))
15
+
16
+ ### Removed
17
+
18
+ - Support for Ruby 3.0 ([#158](https://github.com/cerbos/cerbos-sdk-ruby/pull/158))
19
+
20
+ ## [0.8.0] - 2024-01-12
21
+
22
+ ### Added
23
+
24
+ - `grpc_metadata` option to `Cerbos::Client` constructor and request methods to add gRPC metadata (a.k.a. HTTP headers) to requests to the policy decision point ([#132](https://github.com/cerbos/cerbos-sdk-ruby/pull/132))
25
+
5
26
  ## [0.7.0] - 2023-06-07
6
27
 
7
28
  ### Added
@@ -60,7 +81,7 @@ No notable changes.
60
81
 
61
82
  ### Changed
62
83
 
63
- - Increased `grpc` version requirement to 1.46+ to avoid [installing a native gem compiled for `x86_64-darwin` on `arm64-darwin`](https://github.com/grpc/grpc/issues/29100) ([#8](https://github.com/cerbos/cerbos-sdk-ruby/pull/8))
84
+ - Increased [`grpc`] version requirement to 1.46+ to avoid [installing a native gem compiled for `x86_64-darwin` on `arm64-darwin`](https://github.com/grpc/grpc/issues/29100) ([#8](https://github.com/cerbos/cerbos-sdk-ruby/pull/8))
64
85
 
65
86
  ## [0.1.0] - 2022-05-12
66
87
 
@@ -68,7 +89,9 @@ No notable changes.
68
89
 
69
90
  - Initial implementation of `Cerbos::Client` ([#2](https://github.com/cerbos/cerbos-sdk-ruby/pull/2))
70
91
 
71
- [Unreleased]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.7.0...HEAD
92
+ [Unreleased]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.9.0...HEAD
93
+ [0.9.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.8.0...v0.9.0
94
+ [0.8.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.7.0...v0.8.0
72
95
  [0.7.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.6.1...v0.7.0
73
96
  [0.6.1]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.6.0...v0.6.1
74
97
  [0.6.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.5.0...v0.6.0
@@ -77,3 +100,5 @@ No notable changes.
77
100
  [0.3.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.2.0...v0.3.0
78
101
  [0.2.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/v0.1.0...v0.2.0
79
102
  [0.1.0]: https://github.com/cerbos/cerbos-sdk-ruby/compare/4481009e9dec2e1e6a2df8ea2f828690ceabbefc...v0.1.0
103
+ [`google-protobuf`]: https://rubygems.org/gems/google-protobuf
104
+ [`grpc`]: https://rubygems.org/gems/grpc
data/README.md CHANGED
@@ -12,7 +12,7 @@ The Cerbos Ruby SDK makes it easy to interact with the Cerbos PDP from your Ruby
12
12
  ## Prerequisites
13
13
 
14
14
  - Cerbos 0.16+
15
- - Ruby 3.0+
15
+ - Ruby 3.1+
16
16
 
17
17
  ## Installation
18
18
 
@@ -41,7 +41,7 @@ decision = client.check_resource(
41
41
  resource: {
42
42
  kind: "document",
43
43
  id: "1",
44
- attributes: {
44
+ attr: {
45
45
  owner: "author@example.com"
46
46
  }
47
47
  },
data/cerbos.gemspec CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
  "yard_extensions.rb"
32
32
  ]
33
33
 
34
- spec.required_ruby_version = ">= 3.0.0"
34
+ spec.required_ruby_version = ">= 3.1.0"
35
35
  spec.add_dependency "grpc", "~> 1.46"
36
+ spec.add_dependency "google-protobuf", [">= 3.21.12", "< 4.0"]
36
37
  end
data/lib/cerbos/client.rb CHANGED
@@ -4,14 +4,22 @@ module Cerbos
4
4
  # A client for interacting with the Cerbos policy decision point (PDP) server over gRPC.
5
5
  #
6
6
  # An instance of the client may be shared between threads.
7
- # However, due to [an issue in the underlying `grpc` gem](https://github.com/grpc/grpc/issues/8798), it's not possible to use the client before and after process forks.
8
- # If your application runs on a forking webserver (for example, Puma in clustered mode), then you'll need to ensure that you only create client instances in the child (worker) processes.
7
+ #
8
+ # Due to [a limitation in the underlying `grpc` gem](https://github.com/grpc/grpc/issues/8798), creating a client instance before a process fork is [only (experimentally) supported on Linux](https://github.com/grpc/grpc/pull/33430) and requires you to
9
+ # - have at least v1.57.0 of the `grpc` gem installed,
10
+ # - set the `GRPC_ENABLE_FORK_SUPPORT` environment variable to `1`,
11
+ # - call `GRPC.prefork` before forking,
12
+ # - call `GRPC.postfork_parent` in the parent process after forking, and
13
+ # - call `GRPC.postfork_child` in the child processes after forking.
14
+ #
15
+ # Otherwise, if your application runs on a forking webserver (for example, Puma in clustered mode), then you'll need to ensure that you only create client instances in the child (worker) processes.
9
16
  class Client
10
17
  # Create a client for interacting with the Cerbos PDP server over gRPC.
11
18
  #
12
19
  # @param target [String] Cerbos PDP server address (`"host"`, `"host:port"`, or `"unix:/path/to/socket"`).
13
20
  # @param tls [TLS, MutualTLS, false] gRPC connection encryption settings (`false` for plaintext).
14
21
  # @param grpc_channel_args [Hash{String, Symbol => String, Integer}] low-level settings for the gRPC channel (see [available keys in the gRPC documentation](https://grpc.github.io/grpc/core/group__grpc__arg__keys.html)).
22
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to every request to the PDP.
15
23
  # @param on_validation_error [:return, :raise, #call] action to take when input fails schema validation (`:return` to return the validation errors in the response, `:raise` to raise {Error::ValidationFailed}, or a callback to invoke).
16
24
  # @param playground_instance [String, nil] identifier of the playground instance to use when prototyping against the hosted demo PDP.
17
25
  # @param timeout [Numeric, nil] timeout for gRPC calls, in seconds (`nil` to never time out).
@@ -30,7 +38,8 @@ module Cerbos
30
38
  #
31
39
  # @example Invoke a callback when input fails schema validation
32
40
  # client = Cerbos::Client.new("localhost:3593", tls: false, on_validation_error: ->(validation_errors) { do_something_with validation_errors })
33
- def initialize(target, tls:, grpc_channel_args: {}, on_validation_error: :return, playground_instance: nil, timeout: nil)
41
+ def initialize(target, tls:, grpc_channel_args: {}, grpc_metadata: {}, on_validation_error: :return, playground_instance: nil, timeout: nil)
42
+ @grpc_metadata = grpc_metadata.transform_keys(&:to_sym)
34
43
  @on_validation_error = on_validation_error
35
44
 
36
45
  handle_errors do
@@ -60,6 +69,7 @@ module Cerbos
60
69
  # @param action [String] the action to check.
61
70
  # @param aux_data [Input::AuxData, Hash, nil] auxiliary data.
62
71
  # @param request_id [String] identifier for tracing the request.
72
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to the request.
63
73
  #
64
74
  # @return [Boolean]
65
75
  #
@@ -69,13 +79,14 @@ module Cerbos
69
79
  # resource: {kind: "document", id: "1"},
70
80
  # action: "view"
71
81
  # ) # => true
72
- def allow?(principal:, resource:, action:, aux_data: nil, request_id: SecureRandom.uuid)
82
+ def allow?(principal:, resource:, action:, aux_data: nil, request_id: SecureRandom.uuid, grpc_metadata: {})
73
83
  check_resource(
74
84
  principal: principal,
75
85
  resource: resource,
76
86
  actions: [action],
77
87
  aux_data: aux_data,
78
- request_id: request_id
88
+ request_id: request_id,
89
+ grpc_metadata: grpc_metadata
79
90
  ).allow?(action)
80
91
  end
81
92
 
@@ -87,6 +98,7 @@ module Cerbos
87
98
  # @param aux_data [Input::AuxData, Hash, nil] auxiliary data.
88
99
  # @param include_metadata [Boolean] `true` to include additional metadata ({Output::CheckResources::Result::Metadata}) in the results.
89
100
  # @param request_id [String] identifier for tracing the request.
101
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to the request.
90
102
  #
91
103
  # @return [Output::CheckResources::Result]
92
104
  #
@@ -98,14 +110,15 @@ module Cerbos
98
110
  # )
99
111
  #
100
112
  # decision.allow?("view") # => true
101
- def check_resource(principal:, resource:, actions:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid)
113
+ def check_resource(principal:, resource:, actions:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid, grpc_metadata: {})
102
114
  handle_errors do
103
115
  check_resources(
104
116
  principal: principal,
105
117
  resources: [Input::ResourceCheck.new(resource: resource, actions: actions)],
106
118
  aux_data: aux_data,
107
119
  include_metadata: include_metadata,
108
- request_id: request_id
120
+ request_id: request_id,
121
+ grpc_metadata: grpc_metadata
109
122
  ).find_result(resource)
110
123
  end
111
124
  end
@@ -117,6 +130,7 @@ module Cerbos
117
130
  # @param aux_data [Input::AuxData, Hash, nil] auxiliary data.
118
131
  # @param include_metadata [Boolean] `true` to include additional metadata ({Output::CheckResources::Result::Metadata}) in the results.
119
132
  # @param request_id [String] identifier for tracing the request.
133
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to the request.
120
134
  #
121
135
  # @return [Output::CheckResources]
122
136
  #
@@ -136,7 +150,7 @@ module Cerbos
136
150
  # )
137
151
  #
138
152
  # decision.allow?(resource: {kind: "document", id: "1"}, action: "view") # => true
139
- def check_resources(principal:, resources:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid)
153
+ def check_resources(principal:, resources:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid, grpc_metadata: {})
140
154
  handle_errors do
141
155
  request = Protobuf::Cerbos::Request::V1::CheckResourcesRequest.new(
142
156
  principal: Input.coerce_required(principal, Input::Principal).to_protobuf,
@@ -146,7 +160,7 @@ module Cerbos
146
160
  request_id: request_id
147
161
  )
148
162
 
149
- response = perform_request(@cerbos_service, :check_resources, request)
163
+ response = perform_request(@cerbos_service, :check_resources, request, grpc_metadata)
150
164
 
151
165
  Output::CheckResources.from_protobuf(response).tap do |output|
152
166
  handle_validation_errors output
@@ -162,6 +176,7 @@ module Cerbos
162
176
  # @param aux_data [Input::AuxData, Hash, nil] auxiliary data.
163
177
  # @param include_metadata [Boolean] `true` to include additional metadata ({Output::CheckResources::Result::Metadata}) in the results.
164
178
  # @param request_id [String] identifier for tracing the request.
179
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to the request.
165
180
  #
166
181
  # @return [Output::PlanResources]
167
182
  #
@@ -174,7 +189,7 @@ module Cerbos
174
189
  #
175
190
  # plan.conditional? # => true
176
191
  # plan.condition # => #<Cerbos::Output::PlanResources::Expression ...>
177
- def plan_resources(principal:, resource:, action:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid)
192
+ def plan_resources(principal:, resource:, action:, aux_data: nil, include_metadata: false, request_id: SecureRandom.uuid, grpc_metadata: {})
178
193
  handle_errors do
179
194
  request = Protobuf::Cerbos::Request::V1::PlanResourcesRequest.new(
180
195
  principal: Input.coerce_required(principal, Input::Principal).to_protobuf,
@@ -185,7 +200,7 @@ module Cerbos
185
200
  request_id: request_id
186
201
  )
187
202
 
188
- response = perform_request(@cerbos_service, :plan_resources, request)
203
+ response = perform_request(@cerbos_service, :plan_resources, request, grpc_metadata)
189
204
 
190
205
  Output::PlanResources.from_protobuf(response).tap do |output|
191
206
  handle_validation_errors output
@@ -195,12 +210,14 @@ module Cerbos
195
210
 
196
211
  # Retrieve information about the Cerbos PDP server.
197
212
  #
213
+ # @param grpc_metadata [Hash{String, Symbol => String, Array<String>}] gRPC metadata (a.k.a. HTTP headers) to add to the request.
214
+ #
198
215
  # @return [Output::ServerInfo]
199
- def server_info
216
+ def server_info(grpc_metadata: {})
200
217
  handle_errors do
201
218
  request = Protobuf::Cerbos::Request::V1::ServerInfoRequest.new
202
219
 
203
- response = perform_request(@cerbos_service, :server_info, request)
220
+ response = perform_request(@cerbos_service, :server_info, request, grpc_metadata)
204
221
 
205
222
  Output::ServerInfo.from_protobuf(response)
206
223
  end
@@ -231,8 +248,8 @@ module Cerbos
231
248
  @on_validation_error.call validation_errors
232
249
  end
233
250
 
234
- def perform_request(service, rpc, request)
235
- service.public_send(rpc, request)
251
+ def perform_request(service, rpc, request, metadata)
252
+ service.public_send(rpc, request, metadata: @grpc_metadata.merge(metadata.transform_keys(&:to_sym)))
236
253
  end
237
254
  end
238
255
  end
data/lib/cerbos/error.rb CHANGED
@@ -12,7 +12,7 @@ module Cerbos
12
12
 
13
13
  # @private
14
14
  def initialize(validation_errors)
15
- super "Input failed schema validation"
15
+ super("Input failed schema validation")
16
16
 
17
17
  @validation_errors = validation_errors
18
18
  end
@@ -48,7 +48,7 @@ module Cerbos
48
48
 
49
49
  # @private
50
50
  def initialize(code:, details:, metadata: {})
51
- super "gRPC error #{code}: #{details}"
51
+ super("gRPC error #{code}: #{details}")
52
52
 
53
53
  @code = code
54
54
  @details = details
@@ -17,7 +17,7 @@ module Cerbos
17
17
  # Application-specific attributes describing the principal.
18
18
  #
19
19
  # @return [Attributes]
20
- attr_reader :attributes
20
+ attr_reader :attr
21
21
 
22
22
  # The policy version to use when authorizing the principal.
23
23
  #
@@ -37,23 +37,38 @@ module Cerbos
37
37
  #
38
38
  # @param id [String] a unique identifier for the principal.
39
39
  # @param roles [Array<String>] the roles held by the principal.
40
- # @param attributes [Attributes, Hash] application-specific attributes describing the principal.
40
+ # @param attr [Attributes, Hash] application-specific attributes describing the principal.
41
+ # @param attributes [Attributes, Hash] deprecated (use `attr` instead).
41
42
  # @param policy_version [String, nil] the policy version to use when authorizing the principal (`nil` to use the Cerbos policy decision point server's configured default version).
42
43
  # @param scope [String, nil] the policy scope to use when authorizing the principal.
43
- def initialize(id:, roles:, attributes: {}, policy_version: nil, scope: nil)
44
+ def initialize(id:, roles:, attr: {}, attributes: nil, policy_version: nil, scope: nil)
45
+ unless attributes.nil?
46
+ Cerbos.deprecation_warning "The `attributes` keyword argument is deprecated. Use `attr` instead."
47
+ attr = attributes
48
+ end
49
+
44
50
  @id = id
45
51
  @roles = roles
46
- @attributes = Input.coerce_required(attributes, Attributes)
52
+ @attr = Input.coerce_required(attr, Attributes)
47
53
  @policy_version = policy_version
48
54
  @scope = scope
49
55
  end
50
56
 
57
+ # Application-specific attributes describing the principal.
58
+ #
59
+ # @deprecated Use {#attr} instead.
60
+ # @return [Attributes]
61
+ def attributes
62
+ Cerbos.deprecation_warning "The `attributes` method is deprecated. Use `attr` instead."
63
+ attr
64
+ end
65
+
51
66
  # @private
52
67
  def to_protobuf
53
68
  Protobuf::Cerbos::Engine::V1::Principal.new(
54
69
  id: id,
55
70
  roles: roles,
56
- attr: attributes.to_protobuf,
71
+ attr: attr.to_protobuf,
57
72
  policy_version: policy_version,
58
73
  scope: scope
59
74
  )
@@ -17,7 +17,7 @@ module Cerbos
17
17
  # Application-specific attributes describing the resource.
18
18
  #
19
19
  # @return [Attributes]
20
- attr_reader :attributes
20
+ attr_reader :attr
21
21
 
22
22
  # The policy version to use when checking the principal's permissions on the resource.
23
23
  #
@@ -37,23 +37,38 @@ module Cerbos
37
37
  #
38
38
  # @param kind [String] the type of resource.
39
39
  # @param id [String] a unique identifier for the resource.
40
- # @param attributes [Attributes, Hash] application-specific attributes describing the resource.
40
+ # @param attr [Attributes, Hash] application-specific attributes describing the resource.
41
+ # @param attributes [Attributes, Hash] deprecated (use `attr` instead).
41
42
  # @param policy_version [String, nil] the policy version to use when checking the principal's permissions on the resource (`nil` to use the Cerbos policy decision point server's configured default version).
42
43
  # @param scope [String, nil] the policy scope to use when checking the principal's permissions on the resource.
43
- def initialize(kind:, id:, attributes: {}, policy_version: nil, scope: nil)
44
+ def initialize(kind:, id:, attr: {}, attributes: nil, policy_version: nil, scope: nil)
45
+ unless attributes.nil?
46
+ Cerbos.deprecation_warning "The `attributes` keyword argument is deprecated. Use `attr` instead."
47
+ attr = attributes
48
+ end
49
+
44
50
  @kind = kind
45
51
  @id = id
46
- @attributes = Input.coerce_required(attributes, Attributes)
52
+ @attr = Input.coerce_required(attr, Attributes)
47
53
  @policy_version = policy_version
48
54
  @scope = scope
49
55
  end
50
56
 
57
+ # Application-specific attributes describing the resource.
58
+ #
59
+ # @deprecated Use {#attr} instead.
60
+ # @return [Attributes]
61
+ def attributes
62
+ Cerbos.deprecation_warning "The `attributes` method is deprecated. Use `attr` instead."
63
+ attr
64
+ end
65
+
51
66
  # @private
52
67
  def to_protobuf
53
68
  Protobuf::Cerbos::Engine::V1::Resource.new(
54
69
  kind: kind,
55
70
  id: id,
56
- attr: attributes.to_protobuf,
71
+ attr: attr.to_protobuf,
57
72
  policy_version: policy_version,
58
73
  scope: scope
59
74
  )
@@ -12,7 +12,7 @@ module Cerbos
12
12
  # Any application-specific attributes describing the resources to be queried that are known in advance.
13
13
  #
14
14
  # @return [Attributes]
15
- attr_reader :attributes
15
+ attr_reader :attr
16
16
 
17
17
  # The policy version to use when planning the query.
18
18
  #
@@ -31,21 +31,36 @@ module Cerbos
31
31
  # Specify partial details of resources to be queried.
32
32
  #
33
33
  # @param kind [String] the type of resources to be queried.
34
- # @param attributes [Attributes, Hash] any application-specific attributes describing the resources to be queried that are known in advance.
34
+ # @param attr [Attributes, Hash] any application-specific attributes describing the resources to be queried that are known in advance.
35
+ # @param attributes [Attributes, Hash] deprecated (use `attr` instead).
35
36
  # @param policy_version [String, nil] the policy version to use when planning the query (`nil` to use the Cerbos policy decision point server's configured default version).
36
37
  # @param scope [String, nil] the policy scope to use when planning the query.
37
- def initialize(kind:, attributes: {}, policy_version: nil, scope: nil)
38
+ def initialize(kind:, attr: {}, attributes: nil, policy_version: nil, scope: nil)
39
+ unless attributes.nil?
40
+ Cerbos.deprecation_warning "The `attributes` keyword argument is deprecated. Use `attr` instead."
41
+ attr = attributes
42
+ end
43
+
38
44
  @kind = kind
39
- @attributes = Input.coerce_required(attributes, Attributes)
45
+ @attr = Input.coerce_required(attr, Attributes)
40
46
  @policy_version = policy_version
41
47
  @scope = scope
42
48
  end
43
49
 
50
+ # Any application-specific attributes describing the resources to be queried that are known in advance.
51
+ #
52
+ # @deprecated Use {#attr} instead.
53
+ # @return [Attributes]
54
+ def attributes
55
+ Cerbos.deprecation_warning "The `attributes` method is deprecated. Use `attr` instead."
56
+ attr
57
+ end
58
+
44
59
  # @private
45
60
  def to_protobuf
46
61
  Protobuf::Cerbos::Engine::V1::PlanResourcesInput::Resource.new(
47
62
  kind: kind,
48
- attr: attributes.to_protobuf,
63
+ attr: attr.to_protobuf,
49
64
  policy_version: policy_version,
50
65
  scope: scope
51
66
  )
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: buf/validate/expression.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x1d\x62uf/validate/expression.proto\x12\x0c\x62uf.validate\"V\n\nConstraint\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1e\n\nexpression\x18\x03 \x01(\tR\nexpressionBp\n\x12\x62uild.buf.validateB\x0f\x45xpressionProtoP\x01ZGbuf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validateb\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Cerbos::Protobuf::Buf
14
+ module Validate
15
+ Constraint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("buf.validate.Constraint").msgclass
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: buf/validate/priv/private.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/descriptor_pb'
8
+
9
+
10
+ descriptor_data = "\n\x1f\x62uf/validate/priv/private.proto\x12\x11\x62uf.validate.priv\x1a google/protobuf/descriptor.proto\"C\n\x10\x46ieldConstraints\x12/\n\x03\x63\x65l\x18\x01 \x03(\x0b\x32\x1d.buf.validate.priv.ConstraintR\x03\x63\x65l\"V\n\nConstraint\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12\x1e\n\nexpression\x18\x03 \x01(\tR\nexpression:\\\n\x05\x66ield\x12\x1d.google.protobuf.FieldOptions\x18\x88\t \x01(\x0b\x32#.buf.validate.priv.FieldConstraintsR\x05\x66ield\x88\x01\x01\x42w\n\x17\x62uild.buf.validate.privB\x0cPrivateProtoP\x01ZLbuf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate/privb\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Cerbos::Protobuf::Buf
16
+ module Validate
17
+ module Priv
18
+ FieldConstraints = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("buf.validate.priv.FieldConstraints").msgclass
19
+ Constraint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("buf.validate.priv.Constraint").msgclass
20
+ end
21
+ end
22
+ end