prefab-cloud-ruby 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +4 -11
- data/Gemfile.lock +32 -52
- data/README.md +1 -19
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/compile_protos.sh +0 -3
- data/lib/prefab/auth_interceptor.rb +0 -1
- data/lib/prefab/cancellable_interceptor.rb +0 -1
- data/lib/prefab/client.rb +36 -49
- data/lib/prefab/config_client.rb +73 -145
- data/lib/prefab/config_loader.rb +13 -98
- data/lib/prefab/config_resolver.rb +49 -56
- data/lib/prefab/feature_flag_client.rb +11 -129
- data/lib/prefab/logger_client.rb +8 -10
- data/lib/prefab/murmer3.rb +0 -1
- data/lib/prefab/noop_cache.rb +0 -1
- data/lib/prefab/noop_stats.rb +0 -1
- data/lib/prefab/ratelimit_client.rb +0 -1
- data/lib/prefab-cloud-ruby.rb +0 -10
- data/lib/prefab_pb.rb +132 -214
- data/lib/prefab_services_pb.rb +6 -35
- data/prefab-cloud-ruby.gemspec +11 -30
- data/test/.prefab.test.config.yaml +1 -27
- data/test/test_config_loader.rb +25 -39
- data/test/test_config_resolver.rb +38 -134
- data/test/test_feature_flag_client.rb +35 -277
- data/test/test_helper.rb +4 -70
- data/test/test_logger.rb +29 -23
- metadata +15 -70
- data/.github/workflows/ruby.yml +0 -39
- data/.tool-versions +0 -1
- data/CODEOWNERS +0 -1
- data/lib/prefab/config_helper.rb +0 -29
- data/lib/prefab/error.rb +0 -6
- data/lib/prefab/errors/initialization_timeout_error.rb +0 -13
- data/lib/prefab/errors/invalid_api_key_error.rb +0 -19
- data/lib/prefab/errors/missing_default_error.rb +0 -13
- data/lib/prefab/internal_logger.rb +0 -29
- data/lib/prefab/options.rb +0 -82
- data/run_test_harness_server.sh +0 -8
- data/test/harness_server.rb +0 -64
- data/test/test_client.rb +0 -91
- data/test/test_config_client.rb +0 -56
@@ -1,7 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
module Prefab
|
3
2
|
class FeatureFlagClient
|
4
|
-
include Prefab::ConfigHelper
|
5
3
|
MAX_32_FLOAT = 4294967294.0
|
6
4
|
|
7
5
|
def initialize(base_client)
|
@@ -16,154 +14,38 @@ module Prefab
|
|
16
14
|
feature_is_on_for?(feature_name, nil)
|
17
15
|
end
|
18
16
|
|
19
|
-
def feature_is_on_for?(feature_name, lookup_key, attributes:
|
17
|
+
def feature_is_on_for?(feature_name, lookup_key, attributes: [])
|
20
18
|
@base_client.stats.increment("prefab.featureflag.on", tags: ["feature:#{feature_name}"])
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def get(feature_name, lookup_key=nil, attributes={}, default: false)
|
26
|
-
variant = _get(feature_name, lookup_key, attributes, default: default)
|
27
|
-
|
28
|
-
value_of_variant_or_nil(variant, default)
|
20
|
+
feature_obj = @base_client.config_client.get(feature_name)
|
21
|
+
return is_on?(feature_name, lookup_key, attributes, feature_obj)
|
29
22
|
end
|
30
23
|
|
31
24
|
private
|
32
25
|
|
33
|
-
def
|
34
|
-
if
|
35
|
-
default != Prefab::Client::NO_DEFAULT_PROVIDED ? default : nil
|
36
|
-
else
|
37
|
-
value_of_variant(variant_maybe)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def _get(feature_name, lookup_key=nil, attributes={}, default:)
|
42
|
-
feature_obj = @base_client.config_client.get(feature_name, default)
|
43
|
-
config_obj = @base_client.config_client.get_config_obj(feature_name)
|
44
|
-
|
45
|
-
return nil if feature_obj.nil? || config_obj.nil?
|
46
|
-
|
47
|
-
if feature_obj == !!feature_obj
|
48
|
-
return feature_obj
|
49
|
-
end
|
50
|
-
|
51
|
-
variants = config_obj.variants
|
52
|
-
get_variant(feature_name, lookup_key, attributes, feature_obj, variants)
|
53
|
-
end
|
54
|
-
|
55
|
-
def is_on?(variant)
|
56
|
-
if variant.nil?
|
26
|
+
def is_on?(feature_name, lookup_key, attributes, feature_obj)
|
27
|
+
if feature_obj.nil?
|
57
28
|
return false
|
58
29
|
end
|
59
30
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
variant.bool
|
65
|
-
rescue
|
66
|
-
@base_client.log.info("is_on? methods only work for boolean feature flags variants. This feature flags variant is '#{variant}'. Returning false")
|
67
|
-
false
|
68
|
-
end
|
69
|
-
|
70
|
-
def get_variant(feature_name, lookup_key, attributes, feature_obj, variants)
|
71
|
-
if !feature_obj.active
|
72
|
-
return get_variant_obj(variants, feature_obj.inactive_variant_idx)
|
73
|
-
end
|
74
|
-
|
75
|
-
#default to inactive
|
76
|
-
variant_weights = [Prefab::VariantWeight.new(variant_idx: feature_obj.inactive_variant_idx, weight: 1)]
|
77
|
-
|
78
|
-
# if rules.match
|
79
|
-
feature_obj.rules.each do |rule|
|
80
|
-
if criteria_match?(rule.criteria, lookup_key, attributes)
|
81
|
-
variant_weights = rule.variant_weights
|
82
|
-
break
|
83
|
-
end
|
31
|
+
attributes << lookup_key if lookup_key
|
32
|
+
if (attributes & feature_obj.whitelisted).size > 0
|
33
|
+
return true
|
84
34
|
end
|
85
35
|
|
86
|
-
percent_through_distribution = rand()
|
87
36
|
if lookup_key
|
88
|
-
|
37
|
+
return get_user_pct(feature_name, lookup_key) < feature_obj.pct
|
89
38
|
end
|
90
39
|
|
91
|
-
|
92
|
-
|
93
|
-
return get_variant_obj(variants, variant_idx)
|
94
|
-
end
|
95
|
-
|
96
|
-
def get_variant_obj(variants, idx)
|
97
|
-
# our array is 0 based, but the idx are 1 based so the protos are clearly set
|
98
|
-
return variants[idx - 1] if variants.length >= idx
|
99
|
-
nil
|
100
|
-
end
|
101
|
-
|
102
|
-
def get_variant_idx_from_weights(variant_weights, percent_through_distribution, feature_name)
|
103
|
-
distrubution_space = variant_weights.inject(0) { |sum, v| sum + v.weight }
|
104
|
-
bucket = distrubution_space * percent_through_distribution
|
105
|
-
sum = 0
|
106
|
-
variant_weights.each do |variant_weight|
|
107
|
-
if bucket < sum + variant_weight.weight
|
108
|
-
return variant_weight.variant_idx
|
109
|
-
else
|
110
|
-
sum += variant_weight.weight
|
111
|
-
end
|
112
|
-
end
|
113
|
-
# variants didn't add up to 100%
|
114
|
-
@base_client.log.info("Variants of #{feature_name} did not add to 100%")
|
115
|
-
return variant_weights.last.variant_idx
|
40
|
+
return feature_obj.pct > rand()
|
116
41
|
end
|
117
42
|
|
118
43
|
def get_user_pct(feature, lookup_key)
|
119
|
-
to_hash = "#{@base_client.
|
44
|
+
to_hash = "#{@base_client.account_id}#{feature}#{lookup_key}"
|
120
45
|
int_value = Murmur3.murmur3_32(to_hash)
|
121
46
|
int_value / MAX_32_FLOAT
|
122
47
|
end
|
123
48
|
|
124
|
-
# def criteria_match?(rule, lookup_key, attributes)
|
125
|
-
#
|
126
|
-
# end
|
127
|
-
def criteria_match?(criteria, lookup_key, attributes)
|
128
|
-
if criteria.operator == :ALWAYS_TRUE
|
129
|
-
return true
|
130
|
-
elsif criteria.operator == :LOOKUP_KEY_IN
|
131
|
-
return criteria.values.include?(lookup_key)
|
132
|
-
elsif criteria.operator == :LOOKUP_KEY_NOT_IN
|
133
|
-
return !criteria.values.include?(lookup_key)
|
134
|
-
elsif criteria.operator == :IN_SEG
|
135
|
-
return segment_matches(criteria.values, lookup_key, attributes).any?
|
136
|
-
elsif criteria.operator == :NOT_IN_SEG
|
137
|
-
return segment_matches(criteria.values, lookup_key, attributes).none?
|
138
|
-
elsif criteria.operator == :PROP_IS_ONE_OF
|
139
|
-
return criteria.values.include?(attributes[criteria.property]) || criteria.values.include?(attributes[criteria.property.to_sym])
|
140
|
-
elsif criteria.operator == :PROP_IS_NOT_ONE_OF
|
141
|
-
return !(criteria.values.include?(attributes[criteria.property]) || criteria.values.include?(attributes[criteria.property.to_sym]))
|
142
|
-
end
|
143
|
-
@base_client.log.info("Unknown Operator")
|
144
|
-
false
|
145
|
-
end
|
146
|
-
|
147
|
-
# evaluate each segment key and return whether each one matches
|
148
|
-
# there should be an associated segment available as a standard config obj
|
149
|
-
def segment_matches(segment_keys, lookup_key, attributes)
|
150
|
-
segment_keys.map do |segment_key|
|
151
|
-
segment = @base_client.config_client.get(segment_key)
|
152
|
-
if segment.nil?
|
153
|
-
@base_client.log.info("Missing Segment")
|
154
|
-
false
|
155
|
-
else
|
156
|
-
segment_match?(segment, lookup_key, attributes)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
# does a given segment match?
|
162
|
-
def segment_match?(segment, lookup_key, attributes)
|
163
|
-
segment.criterion.map do |criteria|
|
164
|
-
criteria_match?(criteria, lookup_key, attributes)
|
165
|
-
end.any?
|
166
|
-
end
|
167
49
|
end
|
168
50
|
end
|
169
51
|
|
data/lib/prefab/logger_client.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
module Prefab
|
3
2
|
class LoggerClient < Logger
|
4
3
|
|
5
|
-
SEP = "."
|
6
|
-
BASE = "log_level"
|
7
|
-
UNKNOWN = "unknown"
|
4
|
+
SEP = ".".freeze
|
5
|
+
BASE = "log_level".freeze
|
8
6
|
|
9
7
|
def initialize(logdev, formatter: nil)
|
10
8
|
super(logdev)
|
@@ -109,10 +107,10 @@ module Prefab
|
|
109
107
|
|
110
108
|
# Find the closest match to 'log_level.path' in config
|
111
109
|
def level_of(path)
|
112
|
-
closest_log_level_match = @config_client.get(BASE
|
110
|
+
closest_log_level_match = @config_client.get(BASE) || :warn
|
113
111
|
path.split(SEP).inject([BASE]) do |memo, n|
|
114
112
|
memo << n
|
115
|
-
val = @config_client.get(memo.join(SEP)
|
113
|
+
val = @config_client.get(memo.join(SEP))
|
116
114
|
unless val.nil?
|
117
115
|
closest_log_level_match = val
|
118
116
|
end
|
@@ -124,12 +122,12 @@ module Prefab
|
|
124
122
|
# sanitize & clean the path of the caller so the key
|
125
123
|
# looks like log_level.app.models.user
|
126
124
|
def get_path(absolute_path, base_label)
|
127
|
-
path =
|
125
|
+
path = absolute_path + ""
|
128
126
|
path.slice! Dir.pwd
|
129
127
|
|
130
128
|
path.gsub!(/.*?(?=\/lib\/)/im, "")
|
131
129
|
|
132
|
-
path = path.gsub("/", SEP).gsub(".rb", "")
|
130
|
+
path = "#{path.gsub("/", SEP).gsub(".rb", "")}#{SEP}#{base_label}"
|
133
131
|
path.slice! ".lib"
|
134
132
|
path.slice! SEP
|
135
133
|
path
|
@@ -143,8 +141,8 @@ module Prefab
|
|
143
141
|
# StubConfigClient to be used while config client initializes
|
144
142
|
# since it may log
|
145
143
|
class BootstrappingConfigClient
|
146
|
-
def get(key
|
147
|
-
ENV["PREFAB_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL"] ||
|
144
|
+
def get(key)
|
145
|
+
ENV["PREFAB_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL"] || :info
|
148
146
|
end
|
149
147
|
end
|
150
148
|
end
|
data/lib/prefab/murmer3.rb
CHANGED
data/lib/prefab/noop_cache.rb
CHANGED
data/lib/prefab/noop_stats.rb
CHANGED
data/lib/prefab-cloud-ruby.rb
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
require "concurrent/atomics"
|
3
2
|
require 'concurrent'
|
4
3
|
require 'faraday'
|
5
4
|
require 'openssl'
|
6
|
-
require 'openssl'
|
7
|
-
require 'ld-eventsource'
|
8
5
|
require 'prefab_pb'
|
9
|
-
require 'prefab/error'
|
10
|
-
require 'prefab/errors/initialization_timeout_error'
|
11
|
-
require 'prefab/errors/invalid_api_key_error'
|
12
|
-
require 'prefab/errors/missing_default_error'
|
13
6
|
require 'prefab_services_pb'
|
14
|
-
require 'prefab/options'
|
15
|
-
require 'prefab/internal_logger'
|
16
|
-
require 'prefab/config_helper'
|
17
7
|
require 'prefab/config_loader'
|
18
8
|
require 'prefab/config_resolver'
|
19
9
|
require 'prefab/client'
|
data/lib/prefab_pb.rb
CHANGED
@@ -1,226 +1,144 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
2
|
# source: prefab.proto
|
4
3
|
|
5
4
|
require 'google/protobuf'
|
6
5
|
|
7
6
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
repeated :configs, :message, 1, "prefab.Config"
|
28
|
-
optional :config_service_pointer, :message, 2, "prefab.ConfigServicePointer"
|
29
|
-
end
|
30
|
-
add_message "prefab.Config" do
|
31
|
-
optional :id, :int64, 1
|
32
|
-
optional :project_id, :int64, 2
|
33
|
-
optional :key, :string, 3
|
34
|
-
optional :changed_by, :string, 4
|
35
|
-
repeated :rows, :message, 5, "prefab.ConfigRow"
|
36
|
-
repeated :variants, :message, 6, "prefab.FeatureFlagVariant"
|
37
|
-
end
|
38
|
-
add_message "prefab.ConfigRow" do
|
39
|
-
optional :project_env_id, :int64, 1
|
40
|
-
optional :namespace, :string, 2
|
41
|
-
optional :value, :message, 3, "prefab.ConfigValue"
|
42
|
-
end
|
43
|
-
add_message "prefab.LimitResponse" do
|
44
|
-
optional :passed, :bool, 1
|
45
|
-
optional :expires_at, :int64, 2
|
46
|
-
optional :enforced_group, :string, 3
|
47
|
-
optional :current_bucket, :int64, 4
|
48
|
-
optional :policy_group, :string, 5
|
49
|
-
optional :policy_name, :enum, 6, "prefab.LimitResponse.LimitPolicyNames"
|
50
|
-
optional :policy_limit, :int32, 7
|
51
|
-
optional :amount, :int64, 8
|
52
|
-
optional :limit_reset_at, :int64, 9
|
53
|
-
optional :safety_level, :enum, 10, "prefab.LimitDefinition.SafetyLevel"
|
54
|
-
end
|
55
|
-
add_enum "prefab.LimitResponse.LimitPolicyNames" do
|
56
|
-
value :NOT_SET, 0
|
57
|
-
value :SECONDLY_ROLLING, 1
|
58
|
-
value :MINUTELY_ROLLING, 3
|
59
|
-
value :HOURLY_ROLLING, 5
|
60
|
-
value :DAILY_ROLLING, 7
|
61
|
-
value :MONTHLY_ROLLING, 8
|
62
|
-
value :INFINITE, 9
|
63
|
-
value :YEARLY_ROLLING, 10
|
64
|
-
end
|
65
|
-
add_message "prefab.LimitRequest" do
|
66
|
-
optional :account_id, :int64, 1
|
67
|
-
optional :acquire_amount, :int32, 2
|
68
|
-
repeated :groups, :string, 3
|
69
|
-
optional :limit_combiner, :enum, 4, "prefab.LimitRequest.LimitCombiner"
|
70
|
-
optional :allow_partial_response, :bool, 5
|
71
|
-
optional :safety_level, :enum, 6, "prefab.LimitDefinition.SafetyLevel"
|
72
|
-
end
|
73
|
-
add_enum "prefab.LimitRequest.LimitCombiner" do
|
74
|
-
value :NOT_SET, 0
|
75
|
-
value :MINIMUM, 1
|
76
|
-
value :MAXIMUM, 2
|
77
|
-
end
|
78
|
-
add_message "prefab.FeatureFlagVariant" do
|
79
|
-
proto3_optional :int, :int64, 1
|
80
|
-
proto3_optional :string, :string, 2
|
81
|
-
proto3_optional :double, :double, 3
|
82
|
-
proto3_optional :bool, :bool, 4
|
83
|
-
optional :name, :string, 5
|
84
|
-
optional :description, :string, 6
|
85
|
-
end
|
86
|
-
add_message "prefab.Criteria" do
|
87
|
-
optional :property, :string, 1
|
88
|
-
optional :operator, :enum, 2, "prefab.Criteria.CriteriaOperator"
|
89
|
-
repeated :values, :string, 3
|
90
|
-
end
|
91
|
-
add_enum "prefab.Criteria.CriteriaOperator" do
|
92
|
-
value :NOT_SET, 0
|
93
|
-
value :LOOKUP_KEY_IN, 1
|
94
|
-
value :LOOKUP_KEY_NOT_IN, 2
|
95
|
-
value :IN_SEG, 3
|
96
|
-
value :NOT_IN_SEG, 4
|
97
|
-
value :ALWAYS_TRUE, 5
|
98
|
-
value :PROP_IS_ONE_OF, 6
|
99
|
-
value :PROP_IS_NOT_ONE_OF, 7
|
100
|
-
value :PROP_ENDS_WITH_ONE_OF, 8
|
101
|
-
value :PROP_DOES_NOT_END_WITH_ONE_OF, 9
|
102
|
-
end
|
103
|
-
add_message "prefab.Rule" do
|
104
|
-
optional :criteria, :message, 1, "prefab.Criteria"
|
105
|
-
repeated :variant_weights, :message, 2, "prefab.VariantWeight"
|
106
|
-
end
|
107
|
-
add_message "prefab.Segment" do
|
108
|
-
repeated :criterion, :message, 1, "prefab.Criteria"
|
109
|
-
end
|
110
|
-
add_message "prefab.VariantWeight" do
|
111
|
-
optional :weight, :int32, 1
|
112
|
-
optional :variant_idx, :int32, 2
|
113
|
-
end
|
114
|
-
add_message "prefab.FeatureFlag" do
|
115
|
-
optional :active, :bool, 1
|
116
|
-
optional :inactive_variant_idx, :int32, 2
|
117
|
-
repeated :rules, :message, 5, "prefab.Rule"
|
118
|
-
end
|
119
|
-
add_message "prefab.Identity" do
|
120
|
-
proto3_optional :lookup, :string, 1
|
121
|
-
map :attributes, :string, :string, 2
|
122
|
-
end
|
123
|
-
add_message "prefab.ClientConfigValue" do
|
124
|
-
proto3_optional :int, :int64, 1
|
125
|
-
proto3_optional :string, :string, 2
|
126
|
-
proto3_optional :double, :double, 3
|
127
|
-
proto3_optional :bool, :bool, 4
|
128
|
-
end
|
129
|
-
add_message "prefab.ConfigEvaluations" do
|
130
|
-
map :values, :string, :message, 1, "prefab.ClientConfigValue"
|
131
|
-
end
|
132
|
-
add_message "prefab.LimitDefinition" do
|
133
|
-
optional :policy_name, :enum, 2, "prefab.LimitResponse.LimitPolicyNames"
|
134
|
-
optional :limit, :int32, 3
|
135
|
-
optional :burst, :int32, 4
|
136
|
-
optional :account_id, :int64, 5
|
137
|
-
optional :last_modified, :int64, 6
|
138
|
-
optional :returnable, :bool, 7
|
139
|
-
optional :safety_level, :enum, 8, "prefab.LimitDefinition.SafetyLevel"
|
140
|
-
end
|
141
|
-
add_enum "prefab.LimitDefinition.SafetyLevel" do
|
142
|
-
value :NOT_SET, 0
|
143
|
-
value :L4_BEST_EFFORT, 4
|
144
|
-
value :L5_BOMBPROOF, 5
|
145
|
-
end
|
146
|
-
add_message "prefab.LimitDefinitions" do
|
147
|
-
repeated :definitions, :message, 1, "prefab.LimitDefinition"
|
148
|
-
end
|
149
|
-
add_message "prefab.BufferedRequest" do
|
150
|
-
optional :account_id, :int64, 1
|
151
|
-
optional :method, :string, 2
|
152
|
-
optional :uri, :string, 3
|
153
|
-
optional :body, :string, 4
|
154
|
-
repeated :limit_groups, :string, 5
|
155
|
-
optional :content_type, :string, 6
|
156
|
-
optional :fifo, :bool, 7
|
157
|
-
end
|
158
|
-
add_message "prefab.BatchRequest" do
|
159
|
-
optional :account_id, :int64, 1
|
160
|
-
optional :method, :string, 2
|
161
|
-
optional :uri, :string, 3
|
162
|
-
optional :body, :string, 4
|
163
|
-
repeated :limit_groups, :string, 5
|
164
|
-
optional :batch_template, :string, 6
|
165
|
-
optional :batch_separator, :string, 7
|
166
|
-
end
|
167
|
-
add_message "prefab.BasicResponse" do
|
168
|
-
optional :message, :string, 1
|
169
|
-
end
|
170
|
-
add_message "prefab.CreationResponse" do
|
171
|
-
optional :message, :string, 1
|
172
|
-
optional :new_id, :int64, 2
|
173
|
-
end
|
174
|
-
add_message "prefab.IdBlock" do
|
175
|
-
optional :project_id, :int64, 1
|
176
|
-
optional :project_env_id, :int64, 2
|
177
|
-
optional :sequence_name, :string, 3
|
178
|
-
optional :start, :int64, 4
|
179
|
-
optional :end, :int64, 5
|
180
|
-
end
|
181
|
-
add_message "prefab.IdBlockRequest" do
|
182
|
-
optional :project_id, :int64, 1
|
183
|
-
optional :project_env_id, :int64, 2
|
184
|
-
optional :sequence_name, :string, 3
|
185
|
-
optional :size, :int64, 4
|
186
|
-
end
|
187
|
-
add_enum "prefab.OnFailure" do
|
188
|
-
value :NOT_SET, 0
|
189
|
-
value :LOG_AND_PASS, 1
|
190
|
-
value :LOG_AND_FAIL, 2
|
191
|
-
value :THROW, 3
|
7
|
+
add_message "prefab.ConfigServicePointer" do
|
8
|
+
optional :account_id, :int64, 1
|
9
|
+
optional :start_at_id, :int64, 2
|
10
|
+
end
|
11
|
+
add_message "prefab.ConfigDelta" do
|
12
|
+
optional :id, :int64, 2
|
13
|
+
optional :key, :string, 3
|
14
|
+
optional :value, :message, 4, "prefab.ConfigValue"
|
15
|
+
optional :created_by, :string, 5
|
16
|
+
end
|
17
|
+
add_message "prefab.ConfigValue" do
|
18
|
+
oneof :type do
|
19
|
+
optional :int, :int64, 1
|
20
|
+
optional :string, :string, 2
|
21
|
+
optional :bytes, :bytes, 3
|
22
|
+
optional :double, :double, 4
|
23
|
+
optional :bool, :bool, 5
|
24
|
+
optional :feature_flag, :message, 6, "prefab.FeatureFlag"
|
25
|
+
optional :limit_definition, :message, 7, "prefab.LimitDefinition"
|
192
26
|
end
|
193
27
|
end
|
28
|
+
add_message "prefab.ConfigDeltas" do
|
29
|
+
repeated :deltas, :message, 1, "prefab.ConfigDelta"
|
30
|
+
end
|
31
|
+
add_message "prefab.UpsertRequest" do
|
32
|
+
optional :account_id, :int64, 1
|
33
|
+
optional :config_delta, :message, 2, "prefab.ConfigDelta"
|
34
|
+
optional :changed_by, :string, 4
|
35
|
+
end
|
36
|
+
add_message "prefab.LimitResponse" do
|
37
|
+
optional :passed, :bool, 1
|
38
|
+
optional :expires_at, :int64, 2
|
39
|
+
optional :enforced_group, :string, 3
|
40
|
+
optional :current_bucket, :int64, 4
|
41
|
+
optional :policy_group, :string, 5
|
42
|
+
optional :policy_name, :enum, 6, "prefab.LimitResponse.LimitPolicyNames"
|
43
|
+
optional :policy_limit, :int32, 7
|
44
|
+
optional :amount, :int64, 8
|
45
|
+
optional :limit_reset_at, :int64, 9
|
46
|
+
optional :safety_level, :enum, 10, "prefab.LimitDefinition.SafetyLevel"
|
47
|
+
end
|
48
|
+
add_enum "prefab.LimitResponse.LimitPolicyNames" do
|
49
|
+
value :NOT_SET, 0
|
50
|
+
value :SECONDLY_ROLLING, 1
|
51
|
+
value :MINUTELY_ROLLING, 3
|
52
|
+
value :HOURLY_ROLLING, 5
|
53
|
+
value :DAILY_ROLLING, 7
|
54
|
+
value :MONTHLY_ROLLING, 8
|
55
|
+
value :INFINITE, 9
|
56
|
+
value :YEARLY_ROLLING, 10
|
57
|
+
end
|
58
|
+
add_message "prefab.LimitRequest" do
|
59
|
+
optional :account_id, :int64, 1
|
60
|
+
optional :acquire_amount, :int32, 2
|
61
|
+
repeated :groups, :string, 3
|
62
|
+
optional :limit_combiner, :enum, 4, "prefab.LimitRequest.LimitCombiner"
|
63
|
+
optional :allow_partial_response, :bool, 5
|
64
|
+
optional :safety_level, :enum, 6, "prefab.LimitDefinition.SafetyLevel"
|
65
|
+
end
|
66
|
+
add_enum "prefab.LimitRequest.LimitCombiner" do
|
67
|
+
value :NOT_SET, 0
|
68
|
+
value :MINIMUM, 1
|
69
|
+
value :MAXIMUM, 2
|
70
|
+
end
|
71
|
+
add_message "prefab.FeatureFlag" do
|
72
|
+
optional :pct, :double, 3
|
73
|
+
repeated :whitelisted, :string, 4
|
74
|
+
end
|
75
|
+
add_message "prefab.LimitDefinition" do
|
76
|
+
optional :policy_name, :enum, 2, "prefab.LimitResponse.LimitPolicyNames"
|
77
|
+
optional :limit, :int32, 3
|
78
|
+
optional :burst, :int32, 4
|
79
|
+
optional :account_id, :int64, 5
|
80
|
+
optional :last_modified, :int64, 6
|
81
|
+
optional :returnable, :bool, 7
|
82
|
+
optional :safety_level, :enum, 8, "prefab.LimitDefinition.SafetyLevel"
|
83
|
+
end
|
84
|
+
add_enum "prefab.LimitDefinition.SafetyLevel" do
|
85
|
+
value :NOT_SET, 0
|
86
|
+
value :L4_BEST_EFFORT, 4
|
87
|
+
value :L5_BOMBPROOF, 5
|
88
|
+
end
|
89
|
+
add_message "prefab.LimitDefinitions" do
|
90
|
+
repeated :definitions, :message, 1, "prefab.LimitDefinition"
|
91
|
+
end
|
92
|
+
add_message "prefab.FeatureFlags" do
|
93
|
+
repeated :flags, :message, 1, "prefab.FeatureFlag"
|
94
|
+
optional :cache_expiry, :int64, 2
|
95
|
+
end
|
96
|
+
add_message "prefab.BufferedRequest" do
|
97
|
+
optional :account_id, :int64, 1
|
98
|
+
optional :method, :string, 2
|
99
|
+
optional :uri, :string, 3
|
100
|
+
optional :body, :string, 4
|
101
|
+
repeated :limit_groups, :string, 5
|
102
|
+
optional :content_type, :string, 6
|
103
|
+
optional :fifo, :bool, 7
|
104
|
+
end
|
105
|
+
add_message "prefab.BatchRequest" do
|
106
|
+
optional :account_id, :int64, 1
|
107
|
+
optional :method, :string, 2
|
108
|
+
optional :uri, :string, 3
|
109
|
+
optional :body, :string, 4
|
110
|
+
repeated :limit_groups, :string, 5
|
111
|
+
optional :batch_template, :string, 6
|
112
|
+
optional :batch_separator, :string, 7
|
113
|
+
end
|
114
|
+
add_message "prefab.BasicResponse" do
|
115
|
+
optional :message, :string, 1
|
116
|
+
end
|
117
|
+
add_enum "prefab.OnFailure" do
|
118
|
+
value :NOT_SET, 0
|
119
|
+
value :LOG_AND_PASS, 1
|
120
|
+
value :LOG_AND_FAIL, 2
|
121
|
+
value :THROW, 3
|
122
|
+
end
|
194
123
|
end
|
195
124
|
|
196
125
|
module Prefab
|
197
|
-
ConfigServicePointer =
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
LimitResponse =
|
203
|
-
LimitResponse::LimitPolicyNames =
|
204
|
-
LimitRequest =
|
205
|
-
LimitRequest::LimitCombiner =
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
ConfigEvaluations = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluations").msgclass
|
216
|
-
LimitDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition").msgclass
|
217
|
-
LimitDefinition::SafetyLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition.SafetyLevel").enummodule
|
218
|
-
LimitDefinitions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinitions").msgclass
|
219
|
-
BufferedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BufferedRequest").msgclass
|
220
|
-
BatchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BatchRequest").msgclass
|
221
|
-
BasicResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BasicResponse").msgclass
|
222
|
-
CreationResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.CreationResponse").msgclass
|
223
|
-
IdBlock = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlock").msgclass
|
224
|
-
IdBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlockRequest").msgclass
|
225
|
-
OnFailure = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.OnFailure").enummodule
|
126
|
+
ConfigServicePointer = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigServicePointer").msgclass
|
127
|
+
ConfigDelta = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigDelta").msgclass
|
128
|
+
ConfigValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigValue").msgclass
|
129
|
+
ConfigDeltas = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigDeltas").msgclass
|
130
|
+
UpsertRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.UpsertRequest").msgclass
|
131
|
+
LimitResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitResponse").msgclass
|
132
|
+
LimitResponse::LimitPolicyNames = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitResponse.LimitPolicyNames").enummodule
|
133
|
+
LimitRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest").msgclass
|
134
|
+
LimitRequest::LimitCombiner = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest.LimitCombiner").enummodule
|
135
|
+
FeatureFlag = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.FeatureFlag").msgclass
|
136
|
+
LimitDefinition = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition").msgclass
|
137
|
+
LimitDefinition::SafetyLevel = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition.SafetyLevel").enummodule
|
138
|
+
LimitDefinitions = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinitions").msgclass
|
139
|
+
FeatureFlags = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.FeatureFlags").msgclass
|
140
|
+
BufferedRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BufferedRequest").msgclass
|
141
|
+
BatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BatchRequest").msgclass
|
142
|
+
BasicResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BasicResponse").msgclass
|
143
|
+
OnFailure = Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.OnFailure").enummodule
|
226
144
|
end
|