cerbos 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +9 -0
  3. data/CHANGELOG.md +9 -0
  4. data/LICENSE.txt +190 -0
  5. data/README.md +67 -0
  6. data/cerbos.gemspec +36 -0
  7. data/lib/cerbos/client.rb +188 -0
  8. data/lib/cerbos/error.rb +112 -0
  9. data/lib/cerbos/input/attributes.rb +29 -0
  10. data/lib/cerbos/input/aux_data.rb +26 -0
  11. data/lib/cerbos/input/jwt.rb +38 -0
  12. data/lib/cerbos/input/principal.rb +63 -0
  13. data/lib/cerbos/input/resource.rb +63 -0
  14. data/lib/cerbos/input/resource_check.rb +35 -0
  15. data/lib/cerbos/input/resource_query.rb +55 -0
  16. data/lib/cerbos/input.rb +36 -0
  17. data/lib/cerbos/mutual_tls.rb +33 -0
  18. data/lib/cerbos/output/check_resources.rb +226 -0
  19. data/lib/cerbos/output/plan_resources.rb +149 -0
  20. data/lib/cerbos/output/server_info.rb +38 -0
  21. data/lib/cerbos/output.rb +37 -0
  22. data/lib/cerbos/protobuf/cerbos/audit/v1/audit_pb.rb +48 -0
  23. data/lib/cerbos/protobuf/cerbos/effect/v1/effect_pb.rb +23 -0
  24. data/lib/cerbos/protobuf/cerbos/engine/v1/engine_pb.rb +166 -0
  25. data/lib/cerbos/protobuf/cerbos/policy/v1/policy_pb.rb +247 -0
  26. data/lib/cerbos/protobuf/cerbos/request/v1/request_pb.rb +178 -0
  27. data/lib/cerbos/protobuf/cerbos/response/v1/response_pb.rb +230 -0
  28. data/lib/cerbos/protobuf/cerbos/schema/v1/schema_pb.rb +37 -0
  29. data/lib/cerbos/protobuf/cerbos/svc/v1/svc_pb.rb +21 -0
  30. data/lib/cerbos/protobuf/cerbos/svc/v1/svc_services_pb.rb +73 -0
  31. data/lib/cerbos/protobuf/cerbos/telemetry/v1/telemetry_pb.rb +99 -0
  32. data/lib/cerbos/protobuf/google/api/annotations_pb.rb +17 -0
  33. data/lib/cerbos/protobuf/google/api/expr/v1alpha1/checked_pb.rb +117 -0
  34. data/lib/cerbos/protobuf/google/api/expr/v1alpha1/syntax_pb.rb +113 -0
  35. data/lib/cerbos/protobuf/google/api/field_behavior_pb.rb +27 -0
  36. data/lib/cerbos/protobuf/google/api/http_pb.rb +39 -0
  37. data/lib/cerbos/protobuf/protoc-gen-openapiv2/options/annotations_pb.rb +21 -0
  38. data/lib/cerbos/protobuf/protoc-gen-openapiv2/options/openapiv2_pb.rb +200 -0
  39. data/lib/cerbos/protobuf/validate/validate_pb.rb +293 -0
  40. data/lib/cerbos/protobuf.rb +9 -0
  41. data/lib/cerbos/tls.rb +24 -0
  42. data/lib/cerbos/version.rb +6 -0
  43. data/lib/cerbos.rb +22 -0
  44. data/yard_extensions.rb +33 -0
  45. metadata +107 -0
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cerbos
4
+ module Output
5
+ # Information about the Cerbos policy decision point (PDP) server.
6
+ ServerInfo = Output.new_class(:built_at, :commit, :version) do
7
+ # @!attribute [r] built_at
8
+ # The time at which the PDP server binary was built.
9
+ #
10
+ # @return [Time]
11
+ # @return [nil] if running a custom build of the PDP server that does not report its build time in ISO 8601 format.
12
+
13
+ # @!attribute [r] commit
14
+ # The commit SHA from which the PDP server binary was built.
15
+ #
16
+ # @return [String]
17
+
18
+ # @!attribute [r] version
19
+ # The version of the PDP server.
20
+ #
21
+ # @return [String]
22
+
23
+ def self.from_protobuf(server_info)
24
+ built_at = begin
25
+ Time.iso8601(server_info.build_date)
26
+ rescue ArgumentError
27
+ nil
28
+ end
29
+
30
+ new(
31
+ built_at: built_at,
32
+ commit: server_info.commit,
33
+ version: server_info.version
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cerbos
4
+ # Namespace for objects returned by {Client} methods.
5
+ module Output
6
+ # @private
7
+ def self.new_class(*attributes, &block)
8
+ Class.new do
9
+ attributes.each do |attribute|
10
+ attr_reader attribute
11
+ end
12
+
13
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
14
+ def initialize(#{attributes.map { |attribute| "#{attribute}:" }.join(", ")})
15
+ #{attributes.map { |attribute| "@#{attribute} = #{attribute}" }.join("\n")}
16
+ end
17
+
18
+ def ==(other)
19
+ other.instance_of?(self.class) && #{attributes.map { |attribute| "#{attribute} == other.#{attribute}" }.join(" && ")}
20
+ end
21
+
22
+ def hash
23
+ [#{attributes.join(", ")}].hash
24
+ end
25
+ RUBY
26
+
27
+ alias_method :eql?, :==
28
+
29
+ class_exec(&block) if block
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ require_relative "output/check_resources"
36
+ require_relative "output/plan_resources"
37
+ require_relative "output/server_info"
@@ -0,0 +1,48 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: cerbos/audit/v1/audit.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'cerbos/protobuf/cerbos/engine/v1/engine_pb'
7
+ require 'google/protobuf/timestamp_pb'
8
+
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_file("cerbos/audit/v1/audit.proto", :syntax => :proto3) do
11
+ add_message "cerbos.audit.v1.AccessLogEntry" do
12
+ optional :call_id, :string, 1, json_name: "callId"
13
+ optional :timestamp, :message, 2, "google.protobuf.Timestamp", json_name: "timestamp"
14
+ optional :peer, :message, 3, "cerbos.audit.v1.Peer", json_name: "peer"
15
+ map :metadata, :string, :message, 4, "cerbos.audit.v1.MetaValues"
16
+ optional :method, :string, 5, json_name: "method"
17
+ optional :status_code, :uint32, 6, json_name: "statusCode"
18
+ end
19
+ add_message "cerbos.audit.v1.DecisionLogEntry" do
20
+ optional :call_id, :string, 1, json_name: "callId"
21
+ optional :timestamp, :message, 2, "google.protobuf.Timestamp", json_name: "timestamp"
22
+ optional :peer, :message, 3, "cerbos.audit.v1.Peer", json_name: "peer"
23
+ repeated :inputs, :message, 4, "cerbos.engine.v1.CheckInput", json_name: "inputs"
24
+ repeated :outputs, :message, 5, "cerbos.engine.v1.CheckOutput", json_name: "outputs"
25
+ optional :error, :string, 6, json_name: "error"
26
+ end
27
+ add_message "cerbos.audit.v1.MetaValues" do
28
+ repeated :values, :string, 1, json_name: "values"
29
+ end
30
+ add_message "cerbos.audit.v1.Peer" do
31
+ optional :address, :string, 1, json_name: "address"
32
+ optional :auth_info, :string, 2, json_name: "authInfo"
33
+ optional :user_agent, :string, 3, json_name: "userAgent"
34
+ optional :forwarded_for, :string, 4, json_name: "forwardedFor"
35
+ end
36
+ end
37
+ end
38
+
39
+ module Cerbos::Protobuf::Cerbos
40
+ module Audit
41
+ module V1
42
+ AccessLogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.audit.v1.AccessLogEntry").msgclass
43
+ DecisionLogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.audit.v1.DecisionLogEntry").msgclass
44
+ MetaValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.audit.v1.MetaValues").msgclass
45
+ Peer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.audit.v1.Peer").msgclass
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,23 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: cerbos/effect/v1/effect.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("cerbos/effect/v1/effect.proto", :syntax => :proto3) do
8
+ add_enum "cerbos.effect.v1.Effect" do
9
+ value :EFFECT_UNSPECIFIED, 0
10
+ value :EFFECT_ALLOW, 1
11
+ value :EFFECT_DENY, 2
12
+ value :EFFECT_NO_MATCH, 3
13
+ end
14
+ end
15
+ end
16
+
17
+ module Cerbos::Protobuf::Cerbos
18
+ module Effect
19
+ module V1
20
+ Effect = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.effect.v1.Effect").enummodule
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,166 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: cerbos/engine/v1/engine.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'cerbos/protobuf/cerbos/effect/v1/effect_pb'
7
+ require 'cerbos/protobuf/cerbos/schema/v1/schema_pb'
8
+ require 'cerbos/protobuf/google/api/expr/v1alpha1/checked_pb'
9
+ require 'cerbos/protobuf/google/api/field_behavior_pb'
10
+ require 'google/protobuf/struct_pb'
11
+ require 'cerbos/protobuf/protoc-gen-openapiv2/options/annotations_pb'
12
+ require 'cerbos/protobuf/validate/validate_pb'
13
+
14
+ Google::Protobuf::DescriptorPool.generated_pool.build do
15
+ add_file("cerbos/engine/v1/engine.proto", :syntax => :proto3) do
16
+ add_message "cerbos.engine.v1.PlanResourcesRequest" do
17
+ optional :request_id, :string, 1, json_name: "requestId"
18
+ optional :action, :string, 2, json_name: "action"
19
+ optional :principal, :message, 3, "cerbos.engine.v1.Principal", json_name: "principal"
20
+ optional :resource, :message, 4, "cerbos.engine.v1.PlanResourcesRequest.Resource", json_name: "resource"
21
+ optional :aux_data, :message, 5, "cerbos.engine.v1.AuxData", json_name: "auxData"
22
+ optional :include_meta, :bool, 6, json_name: "includeMeta"
23
+ end
24
+ add_message "cerbos.engine.v1.PlanResourcesRequest.Resource" do
25
+ optional :kind, :string, 1, json_name: "kind"
26
+ map :attr, :string, :message, 2, "google.protobuf.Value"
27
+ optional :policy_version, :string, 3, json_name: "policyVersion"
28
+ optional :scope, :string, 4, json_name: "scope"
29
+ end
30
+ add_message "cerbos.engine.v1.CheckInput" do
31
+ optional :request_id, :string, 1, json_name: "requestId"
32
+ optional :resource, :message, 2, "cerbos.engine.v1.Resource", json_name: "resource"
33
+ optional :principal, :message, 3, "cerbos.engine.v1.Principal", json_name: "principal"
34
+ repeated :actions, :string, 4, json_name: "actions"
35
+ optional :aux_data, :message, 5, "cerbos.engine.v1.AuxData", json_name: "auxData"
36
+ end
37
+ add_message "cerbos.engine.v1.CheckOutput" do
38
+ optional :request_id, :string, 1, json_name: "requestId"
39
+ optional :resource_id, :string, 2, json_name: "resourceId"
40
+ map :actions, :string, :message, 3, "cerbos.engine.v1.CheckOutput.ActionEffect"
41
+ repeated :effective_derived_roles, :string, 4, json_name: "effectiveDerivedRoles"
42
+ repeated :validation_errors, :message, 5, "cerbos.schema.v1.ValidationError", json_name: "validationErrors"
43
+ end
44
+ add_message "cerbos.engine.v1.CheckOutput.ActionEffect" do
45
+ optional :effect, :enum, 1, "cerbos.effect.v1.Effect", json_name: "effect"
46
+ optional :policy, :string, 2, json_name: "policy"
47
+ optional :scope, :string, 3, json_name: "scope"
48
+ end
49
+ add_message "cerbos.engine.v1.PlanResourcesOutput" do
50
+ optional :request_id, :string, 1, json_name: "requestId"
51
+ optional :action, :string, 2, json_name: "action"
52
+ optional :kind, :string, 3, json_name: "kind"
53
+ optional :policy_version, :string, 4, json_name: "policyVersion"
54
+ optional :scope, :string, 5, json_name: "scope"
55
+ optional :filter, :message, 6, "cerbos.engine.v1.PlanResourcesOutput.Node", json_name: "filter"
56
+ end
57
+ add_message "cerbos.engine.v1.PlanResourcesOutput.Node" do
58
+ oneof :node do
59
+ optional :logical_operation, :message, 1, "cerbos.engine.v1.PlanResourcesOutput.LogicalOperation", json_name: "logicalOperation"
60
+ optional :expression, :message, 2, "google.api.expr.v1alpha1.CheckedExpr", json_name: "expression"
61
+ end
62
+ end
63
+ add_message "cerbos.engine.v1.PlanResourcesOutput.LogicalOperation" do
64
+ optional :operator, :enum, 1, "cerbos.engine.v1.PlanResourcesOutput.LogicalOperation.Operator", json_name: "operator"
65
+ repeated :nodes, :message, 2, "cerbos.engine.v1.PlanResourcesOutput.Node", json_name: "nodes"
66
+ end
67
+ add_enum "cerbos.engine.v1.PlanResourcesOutput.LogicalOperation.Operator" do
68
+ value :OPERATOR_UNSPECIFIED, 0
69
+ value :OPERATOR_AND, 1
70
+ value :OPERATOR_OR, 2
71
+ value :OPERATOR_NOT, 3
72
+ end
73
+ add_message "cerbos.engine.v1.Resource" do
74
+ optional :kind, :string, 1, json_name: "kind"
75
+ optional :policy_version, :string, 2, json_name: "policyVersion"
76
+ optional :id, :string, 3, json_name: "id"
77
+ map :attr, :string, :message, 4, "google.protobuf.Value"
78
+ optional :scope, :string, 5, json_name: "scope"
79
+ end
80
+ add_message "cerbos.engine.v1.Principal" do
81
+ optional :id, :string, 1, json_name: "id"
82
+ optional :policy_version, :string, 2, json_name: "policyVersion"
83
+ repeated :roles, :string, 3, json_name: "roles"
84
+ map :attr, :string, :message, 4, "google.protobuf.Value"
85
+ optional :scope, :string, 5, json_name: "scope"
86
+ end
87
+ add_message "cerbos.engine.v1.AuxData" do
88
+ map :jwt, :string, :message, 1, "google.protobuf.Value"
89
+ end
90
+ add_message "cerbos.engine.v1.Trace" do
91
+ repeated :components, :message, 1, "cerbos.engine.v1.Trace.Component", json_name: "components"
92
+ optional :event, :message, 2, "cerbos.engine.v1.Trace.Event", json_name: "event"
93
+ end
94
+ add_message "cerbos.engine.v1.Trace.Component" do
95
+ optional :kind, :enum, 1, "cerbos.engine.v1.Trace.Component.Kind", json_name: "kind"
96
+ oneof :details do
97
+ optional :action, :string, 2, json_name: "action"
98
+ optional :derived_role, :string, 3, json_name: "derivedRole"
99
+ optional :expr, :string, 4, json_name: "expr"
100
+ optional :index, :uint32, 5, json_name: "index"
101
+ optional :policy, :string, 6, json_name: "policy"
102
+ optional :resource, :string, 7, json_name: "resource"
103
+ optional :rule, :string, 8, json_name: "rule"
104
+ optional :scope, :string, 9, json_name: "scope"
105
+ optional :variable, :message, 10, "cerbos.engine.v1.Trace.Component.Variable", json_name: "variable"
106
+ end
107
+ end
108
+ add_message "cerbos.engine.v1.Trace.Component.Variable" do
109
+ optional :name, :string, 1, json_name: "name"
110
+ optional :expr, :string, 2, json_name: "expr"
111
+ end
112
+ add_enum "cerbos.engine.v1.Trace.Component.Kind" do
113
+ value :KIND_UNSPECIFIED, 0
114
+ value :KIND_ACTION, 1
115
+ value :KIND_CONDITION_ALL, 2
116
+ value :KIND_CONDITION_ANY, 3
117
+ value :KIND_CONDITION_NONE, 4
118
+ value :KIND_CONDITION, 5
119
+ value :KIND_DERIVED_ROLE, 6
120
+ value :KIND_EXPR, 7
121
+ value :KIND_POLICY, 8
122
+ value :KIND_RESOURCE, 9
123
+ value :KIND_RULE, 10
124
+ value :KIND_SCOPE, 11
125
+ value :KIND_VARIABLE, 12
126
+ value :KIND_VARIABLES, 13
127
+ end
128
+ add_message "cerbos.engine.v1.Trace.Event" do
129
+ optional :status, :enum, 1, "cerbos.engine.v1.Trace.Event.Status", json_name: "status"
130
+ optional :effect, :enum, 2, "cerbos.effect.v1.Effect", json_name: "effect"
131
+ optional :error, :string, 3, json_name: "error"
132
+ optional :message, :string, 4, json_name: "message"
133
+ optional :result, :message, 5, "google.protobuf.Value", json_name: "result"
134
+ end
135
+ add_enum "cerbos.engine.v1.Trace.Event.Status" do
136
+ value :STATUS_UNSPECIFIED, 0
137
+ value :STATUS_ACTIVATED, 1
138
+ value :STATUS_SKIPPED, 2
139
+ end
140
+ end
141
+ end
142
+
143
+ module Cerbos::Protobuf::Cerbos
144
+ module Engine
145
+ module V1
146
+ PlanResourcesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesRequest").msgclass
147
+ PlanResourcesRequest::Resource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesRequest.Resource").msgclass
148
+ CheckInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.CheckInput").msgclass
149
+ CheckOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.CheckOutput").msgclass
150
+ CheckOutput::ActionEffect = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.CheckOutput.ActionEffect").msgclass
151
+ PlanResourcesOutput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesOutput").msgclass
152
+ PlanResourcesOutput::Node = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesOutput.Node").msgclass
153
+ PlanResourcesOutput::LogicalOperation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesOutput.LogicalOperation").msgclass
154
+ PlanResourcesOutput::LogicalOperation::Operator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.PlanResourcesOutput.LogicalOperation.Operator").enummodule
155
+ Resource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Resource").msgclass
156
+ Principal = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Principal").msgclass
157
+ AuxData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.AuxData").msgclass
158
+ Trace = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace").msgclass
159
+ Trace::Component = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace.Component").msgclass
160
+ Trace::Component::Variable = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace.Component.Variable").msgclass
161
+ Trace::Component::Kind = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace.Component.Kind").enummodule
162
+ Trace::Event = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace.Event").msgclass
163
+ Trace::Event::Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.engine.v1.Trace.Event.Status").enummodule
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,247 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: cerbos/policy/v1/policy.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'cerbos/protobuf/cerbos/effect/v1/effect_pb'
7
+ require 'cerbos/protobuf/cerbos/engine/v1/engine_pb'
8
+ require 'google/protobuf/wrappers_pb'
9
+ require 'cerbos/protobuf/validate/validate_pb'
10
+
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_file("cerbos/policy/v1/policy.proto", :syntax => :proto3) do
13
+ add_message "cerbos.policy.v1.Policy" do
14
+ optional :api_version, :string, 1, json_name: "apiVersion"
15
+ optional :disabled, :bool, 2, json_name: "disabled"
16
+ optional :description, :string, 3, json_name: "description"
17
+ optional :metadata, :message, 4, "cerbos.policy.v1.Metadata", json_name: "metadata"
18
+ map :variables, :string, :string, 8
19
+ oneof :policy_type do
20
+ optional :resource_policy, :message, 5, "cerbos.policy.v1.ResourcePolicy", json_name: "resourcePolicy"
21
+ optional :principal_policy, :message, 6, "cerbos.policy.v1.PrincipalPolicy", json_name: "principalPolicy"
22
+ optional :derived_roles, :message, 7, "cerbos.policy.v1.DerivedRoles", json_name: "derivedRoles"
23
+ end
24
+ end
25
+ add_message "cerbos.policy.v1.Metadata" do
26
+ optional :source_file, :string, 1, json_name: "sourceFile"
27
+ map :annotations, :string, :string, 2
28
+ optional :hash, :message, 3, "google.protobuf.UInt64Value", json_name: "hash"
29
+ optional :store_identifer, :string, 4, json_name: "storeIdentifer"
30
+ end
31
+ add_message "cerbos.policy.v1.ResourcePolicy" do
32
+ optional :resource, :string, 1, json_name: "resource"
33
+ optional :version, :string, 2, json_name: "version"
34
+ repeated :import_derived_roles, :string, 3, json_name: "importDerivedRoles"
35
+ repeated :rules, :message, 4, "cerbos.policy.v1.ResourceRule", json_name: "rules"
36
+ optional :scope, :string, 5, json_name: "scope"
37
+ optional :schemas, :message, 6, "cerbos.policy.v1.Schemas", json_name: "schemas"
38
+ end
39
+ add_message "cerbos.policy.v1.ResourceRule" do
40
+ repeated :actions, :string, 1, json_name: "actions"
41
+ repeated :derived_roles, :string, 2, json_name: "derivedRoles"
42
+ repeated :roles, :string, 3, json_name: "roles"
43
+ optional :condition, :message, 4, "cerbos.policy.v1.Condition", json_name: "condition"
44
+ optional :effect, :enum, 5, "cerbos.effect.v1.Effect", json_name: "effect"
45
+ optional :name, :string, 6, json_name: "name"
46
+ end
47
+ add_message "cerbos.policy.v1.PrincipalPolicy" do
48
+ optional :principal, :string, 1, json_name: "principal"
49
+ optional :version, :string, 2, json_name: "version"
50
+ repeated :rules, :message, 3, "cerbos.policy.v1.PrincipalRule", json_name: "rules"
51
+ optional :scope, :string, 4, json_name: "scope"
52
+ end
53
+ add_message "cerbos.policy.v1.PrincipalRule" do
54
+ optional :resource, :string, 1, json_name: "resource"
55
+ repeated :actions, :message, 2, "cerbos.policy.v1.PrincipalRule.Action", json_name: "actions"
56
+ end
57
+ add_message "cerbos.policy.v1.PrincipalRule.Action" do
58
+ optional :action, :string, 1, json_name: "action"
59
+ optional :condition, :message, 2, "cerbos.policy.v1.Condition", json_name: "condition"
60
+ optional :effect, :enum, 3, "cerbos.effect.v1.Effect", json_name: "effect"
61
+ optional :name, :string, 4, json_name: "name"
62
+ end
63
+ add_message "cerbos.policy.v1.DerivedRoles" do
64
+ optional :name, :string, 1, json_name: "name"
65
+ repeated :definitions, :message, 2, "cerbos.policy.v1.RoleDef", json_name: "definitions"
66
+ end
67
+ add_message "cerbos.policy.v1.RoleDef" do
68
+ optional :name, :string, 1, json_name: "name"
69
+ repeated :parent_roles, :string, 2, json_name: "parentRoles"
70
+ optional :condition, :message, 3, "cerbos.policy.v1.Condition", json_name: "condition"
71
+ end
72
+ add_message "cerbos.policy.v1.Condition" do
73
+ oneof :condition do
74
+ optional :match, :message, 1, "cerbos.policy.v1.Match", json_name: "match"
75
+ optional :script, :string, 2, json_name: "script"
76
+ end
77
+ end
78
+ add_message "cerbos.policy.v1.Match" do
79
+ oneof :op do
80
+ optional :all, :message, 1, "cerbos.policy.v1.Match.ExprList", json_name: "all"
81
+ optional :any, :message, 2, "cerbos.policy.v1.Match.ExprList", json_name: "any"
82
+ optional :none, :message, 3, "cerbos.policy.v1.Match.ExprList", json_name: "none"
83
+ optional :expr, :string, 4, json_name: "expr"
84
+ end
85
+ end
86
+ add_message "cerbos.policy.v1.Match.ExprList" do
87
+ repeated :of, :message, 1, "cerbos.policy.v1.Match", json_name: "of"
88
+ end
89
+ add_message "cerbos.policy.v1.Schemas" do
90
+ optional :principal_schema, :message, 1, "cerbos.policy.v1.Schemas.Schema", json_name: "principalSchema"
91
+ optional :resource_schema, :message, 2, "cerbos.policy.v1.Schemas.Schema", json_name: "resourceSchema"
92
+ end
93
+ add_message "cerbos.policy.v1.Schemas.IgnoreWhen" do
94
+ repeated :actions, :string, 1, json_name: "actions"
95
+ end
96
+ add_message "cerbos.policy.v1.Schemas.Schema" do
97
+ optional :ref, :string, 1, json_name: "ref"
98
+ optional :ignore_when, :message, 2, "cerbos.policy.v1.Schemas.IgnoreWhen", json_name: "ignoreWhen"
99
+ end
100
+ add_message "cerbos.policy.v1.TestFixture" do
101
+ end
102
+ add_message "cerbos.policy.v1.TestFixture.Principals" do
103
+ map :principals, :string, :message, 1, "cerbos.engine.v1.Principal"
104
+ end
105
+ add_message "cerbos.policy.v1.TestFixture.Resources" do
106
+ map :resources, :string, :message, 1, "cerbos.engine.v1.Resource"
107
+ end
108
+ add_message "cerbos.policy.v1.TestFixture.AuxData" do
109
+ map :aux_data, :string, :message, 1, "cerbos.engine.v1.AuxData"
110
+ end
111
+ add_message "cerbos.policy.v1.TestSuite" do
112
+ optional :name, :string, 1, json_name: "name"
113
+ optional :description, :string, 2, json_name: "description"
114
+ optional :skip, :bool, 3, json_name: "skip"
115
+ optional :skip_reason, :string, 4, json_name: "skipReason"
116
+ repeated :tests, :message, 5, "cerbos.policy.v1.TestTable", json_name: "tests"
117
+ map :principals, :string, :message, 6, "cerbos.engine.v1.Principal"
118
+ map :resources, :string, :message, 7, "cerbos.engine.v1.Resource"
119
+ map :aux_data, :string, :message, 8, "cerbos.engine.v1.AuxData"
120
+ end
121
+ add_message "cerbos.policy.v1.TestTable" do
122
+ optional :name, :string, 1, json_name: "name"
123
+ optional :description, :string, 2, json_name: "description"
124
+ optional :skip, :bool, 3, json_name: "skip"
125
+ optional :skip_reason, :string, 4, json_name: "skipReason"
126
+ optional :input, :message, 5, "cerbos.policy.v1.TestTable.Input", json_name: "input"
127
+ repeated :expected, :message, 6, "cerbos.policy.v1.TestTable.Expectation", json_name: "expected"
128
+ end
129
+ add_message "cerbos.policy.v1.TestTable.Input" do
130
+ repeated :principals, :string, 1, json_name: "principals"
131
+ repeated :resources, :string, 2, json_name: "resources"
132
+ repeated :actions, :string, 3, json_name: "actions"
133
+ optional :aux_data, :string, 4, json_name: "auxData"
134
+ end
135
+ add_message "cerbos.policy.v1.TestTable.Expectation" do
136
+ optional :principal, :string, 1, json_name: "principal"
137
+ optional :resource, :string, 2, json_name: "resource"
138
+ map :actions, :string, :enum, 3, "cerbos.effect.v1.Effect"
139
+ end
140
+ add_message "cerbos.policy.v1.Test" do
141
+ optional :name, :message, 1, "cerbos.policy.v1.Test.TestName", json_name: "name"
142
+ optional :description, :string, 2, json_name: "description"
143
+ optional :skip, :bool, 3, json_name: "skip"
144
+ optional :skip_reason, :string, 4, json_name: "skipReason"
145
+ optional :input, :message, 5, "cerbos.engine.v1.CheckInput", json_name: "input"
146
+ map :expected, :string, :enum, 6, "cerbos.effect.v1.Effect"
147
+ end
148
+ add_message "cerbos.policy.v1.Test.TestName" do
149
+ optional :test_table_name, :string, 1, json_name: "testTableName"
150
+ optional :principal_key, :string, 2, json_name: "principalKey"
151
+ optional :resource_key, :string, 3, json_name: "resourceKey"
152
+ end
153
+ add_message "cerbos.policy.v1.TestResults" do
154
+ repeated :suites, :message, 1, "cerbos.policy.v1.TestResults.Suite", json_name: "suites"
155
+ optional :summary, :message, 2, "cerbos.policy.v1.TestResults.Summary", json_name: "summary"
156
+ end
157
+ add_message "cerbos.policy.v1.TestResults.Tally" do
158
+ optional :result, :enum, 1, "cerbos.policy.v1.TestResults.Result", json_name: "result"
159
+ optional :count, :uint32, 2, json_name: "count"
160
+ end
161
+ add_message "cerbos.policy.v1.TestResults.Summary" do
162
+ optional :overall_result, :enum, 1, "cerbos.policy.v1.TestResults.Result", json_name: "overallResult"
163
+ optional :tests_count, :uint32, 2, json_name: "testsCount"
164
+ repeated :result_counts, :message, 3, "cerbos.policy.v1.TestResults.Tally", json_name: "resultCounts"
165
+ end
166
+ add_message "cerbos.policy.v1.TestResults.Suite" do
167
+ optional :file, :string, 1, json_name: "file"
168
+ optional :name, :string, 2, json_name: "name"
169
+ repeated :principals, :message, 3, "cerbos.policy.v1.TestResults.Principal", json_name: "principals"
170
+ optional :summary, :message, 4, "cerbos.policy.v1.TestResults.Summary", json_name: "summary"
171
+ optional :error, :string, 5, json_name: "error"
172
+ end
173
+ add_message "cerbos.policy.v1.TestResults.Principal" do
174
+ optional :name, :string, 1, json_name: "name"
175
+ repeated :resources, :message, 2, "cerbos.policy.v1.TestResults.Resource", json_name: "resources"
176
+ end
177
+ add_message "cerbos.policy.v1.TestResults.Resource" do
178
+ optional :name, :string, 1, json_name: "name"
179
+ repeated :actions, :message, 2, "cerbos.policy.v1.TestResults.Action", json_name: "actions"
180
+ end
181
+ add_message "cerbos.policy.v1.TestResults.Action" do
182
+ optional :name, :string, 1, json_name: "name"
183
+ optional :details, :message, 2, "cerbos.policy.v1.TestResults.Details", json_name: "details"
184
+ end
185
+ add_message "cerbos.policy.v1.TestResults.Details" do
186
+ optional :result, :enum, 1, "cerbos.policy.v1.TestResults.Result", json_name: "result"
187
+ repeated :engine_trace, :message, 4, "cerbos.engine.v1.Trace", json_name: "engineTrace"
188
+ oneof :outcome do
189
+ optional :failure, :message, 2, "cerbos.policy.v1.TestResults.Failure", json_name: "failure"
190
+ optional :error, :string, 3, json_name: "error"
191
+ end
192
+ end
193
+ add_message "cerbos.policy.v1.TestResults.Failure" do
194
+ optional :expected, :enum, 1, "cerbos.effect.v1.Effect", json_name: "expected"
195
+ optional :actual, :enum, 2, "cerbos.effect.v1.Effect", json_name: "actual"
196
+ end
197
+ add_enum "cerbos.policy.v1.TestResults.Result" do
198
+ value :RESULT_UNSPECIFIED, 0
199
+ value :RESULT_SKIPPED, 1
200
+ value :RESULT_PASSED, 2
201
+ value :RESULT_FAILED, 3
202
+ value :RESULT_ERRORED, 4
203
+ end
204
+ end
205
+ end
206
+
207
+ module Cerbos::Protobuf::Cerbos
208
+ module Policy
209
+ module V1
210
+ Policy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Policy").msgclass
211
+ Metadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Metadata").msgclass
212
+ ResourcePolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.ResourcePolicy").msgclass
213
+ ResourceRule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.ResourceRule").msgclass
214
+ PrincipalPolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.PrincipalPolicy").msgclass
215
+ PrincipalRule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.PrincipalRule").msgclass
216
+ PrincipalRule::Action = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.PrincipalRule.Action").msgclass
217
+ DerivedRoles = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.DerivedRoles").msgclass
218
+ RoleDef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.RoleDef").msgclass
219
+ Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Condition").msgclass
220
+ Match = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Match").msgclass
221
+ Match::ExprList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Match.ExprList").msgclass
222
+ Schemas = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Schemas").msgclass
223
+ Schemas::IgnoreWhen = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Schemas.IgnoreWhen").msgclass
224
+ Schemas::Schema = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Schemas.Schema").msgclass
225
+ TestFixture = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestFixture").msgclass
226
+ TestFixture::Principals = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestFixture.Principals").msgclass
227
+ TestFixture::Resources = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestFixture.Resources").msgclass
228
+ TestFixture::AuxData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestFixture.AuxData").msgclass
229
+ TestSuite = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestSuite").msgclass
230
+ TestTable = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestTable").msgclass
231
+ TestTable::Input = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestTable.Input").msgclass
232
+ TestTable::Expectation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestTable.Expectation").msgclass
233
+ Test = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Test").msgclass
234
+ Test::TestName = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.Test.TestName").msgclass
235
+ TestResults = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults").msgclass
236
+ TestResults::Tally = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Tally").msgclass
237
+ TestResults::Summary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Summary").msgclass
238
+ TestResults::Suite = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Suite").msgclass
239
+ TestResults::Principal = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Principal").msgclass
240
+ TestResults::Resource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Resource").msgclass
241
+ TestResults::Action = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Action").msgclass
242
+ TestResults::Details = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Details").msgclass
243
+ TestResults::Failure = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Failure").msgclass
244
+ TestResults::Result = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cerbos.policy.v1.TestResults.Result").enummodule
245
+ end
246
+ end
247
+ end