Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: envoy/config/rbac/v2/rbac.proto
package io.envoyproxy.envoy.config.rbac.v2;
/**
*
* Role Based Access Control (RBAC) provides service-level and method-level access control for a
* service. RBAC policies are additive. The policies are examined in order. A request is allowed
* once a matching policy is found (suppose the `action` is ALLOW).
* Here is an example of RBAC configuration. It has two policies:
* * Service account "cluster.local/ns/default/sa/admin" has full access to the service, and so
* does "cluster.local/ns/default/sa/superuser".
* * Any user can read ("GET") the service at paths with prefix "/products", so long as the
* destination port is either 80 or 443.
* .. code-block:: yaml
* action: ALLOW
* policies:
* "service-admin":
* permissions:
* - any: true
* principals:
* - authenticated:
* principal_name:
* exact: "cluster.local/ns/default/sa/admin"
* - authenticated:
* principal_name:
* exact: "cluster.local/ns/default/sa/superuser"
* "product-viewer":
* permissions:
* - and_rules:
* rules:
* - header: { name: ":method", exact_match: "GET" }
* - url_path:
* path: { prefix: "/products" }
* - or_rules:
* rules:
* - destination_port: 80
* - destination_port: 443
* principals:
* - any: true
*
*
* Protobuf type {@code envoy.config.rbac.v2.RBAC}
*/
public final class RBAC extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:envoy.config.rbac.v2.RBAC)
RBACOrBuilder {
private static final long serialVersionUID = 0L;
// Use RBAC.newBuilder() to construct.
private RBAC(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private RBAC() {
action_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new RBAC();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private RBAC(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
int rawValue = input.readEnum();
action_ = rawValue;
break;
}
case 18: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
policies_ = com.google.protobuf.MapField.newMapField(
PoliciesDefaultEntryHolder.defaultEntry);
mutable_bitField0_ |= 0x00000001;
}
com.google.protobuf.MapEntry
policies__ = input.readMessage(
PoliciesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
policies_.getMutableMap().put(
policies__.getKey(), policies__.getValue());
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_descriptor;
}
@SuppressWarnings({"rawtypes"})
@java.lang.Override
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 2:
return internalGetPolicies();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.envoyproxy.envoy.config.rbac.v2.RBAC.class, io.envoyproxy.envoy.config.rbac.v2.RBAC.Builder.class);
}
/**
*
* Should we do safe-list or block-list style access control?
*
* The policies grant access to principals. The rest is denied. This is safe-list style
* access control. This is the default type.
*
*
* ALLOW = 0;
*/
public static final int ALLOW_VALUE = 0;
/**
*
* The policies deny access to principals. The rest is allowed. This is block-list style
* access control.
*
*
* DENY = 1;
*/
public static final int DENY_VALUE = 1;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static Action valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static Action forNumber(int value) {
switch (value) {
case 0: return ALLOW;
case 1: return DENY;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
Action> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap() {
public Action findValueByNumber(int number) {
return Action.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return io.envoyproxy.envoy.config.rbac.v2.RBAC.getDescriptor().getEnumTypes().get(0);
}
private static final Action[] VALUES = values();
public static Action valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private Action(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:envoy.config.rbac.v2.RBAC.Action)
}
public static final int ACTION_FIELD_NUMBER = 1;
private int action_;
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @return The enum numeric value on the wire for action.
*/
@java.lang.Override public int getActionValue() {
return action_;
}
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @return The action.
*/
@java.lang.Override public io.envoyproxy.envoy.config.rbac.v2.RBAC.Action getAction() {
@SuppressWarnings("deprecation")
io.envoyproxy.envoy.config.rbac.v2.RBAC.Action result = io.envoyproxy.envoy.config.rbac.v2.RBAC.Action.valueOf(action_);
return result == null ? io.envoyproxy.envoy.config.rbac.v2.RBAC.Action.UNRECOGNIZED : result;
}
public static final int POLICIES_FIELD_NUMBER = 2;
private static final class PoliciesDefaultEntryHolder {
static final com.google.protobuf.MapEntry<
java.lang.String, io.envoyproxy.envoy.config.rbac.v2.Policy> defaultEntry =
com.google.protobuf.MapEntry
.newDefaultInstance(
io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_PoliciesEntry_descriptor,
com.google.protobuf.WireFormat.FieldType.STRING,
"",
com.google.protobuf.WireFormat.FieldType.MESSAGE,
io.envoyproxy.envoy.config.rbac.v2.Policy.getDefaultInstance());
}
private com.google.protobuf.MapField<
java.lang.String, io.envoyproxy.envoy.config.rbac.v2.Policy> policies_;
private com.google.protobuf.MapField
internalGetPolicies() {
if (policies_ == null) {
return com.google.protobuf.MapField.emptyMapField(
PoliciesDefaultEntryHolder.defaultEntry);
}
return policies_;
}
public int getPoliciesCount() {
return internalGetPolicies().getMap().size();
}
/**
*
* Maps from policy name to policy. A match occurs when at least one policy matches the request.
*
*
* map<string, .envoy.config.rbac.v2.Policy> policies = 2;
*/
@java.lang.Override
public boolean containsPolicies(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
return internalGetPolicies().getMap().containsKey(key);
}
/**
* Use {@link #getPoliciesMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getPolicies() {
return getPoliciesMap();
}
/**
*
* Maps from policy name to policy. A match occurs when at least one policy matches the request.
*
* Role Based Access Control (RBAC) provides service-level and method-level access control for a
* service. RBAC policies are additive. The policies are examined in order. A request is allowed
* once a matching policy is found (suppose the `action` is ALLOW).
* Here is an example of RBAC configuration. It has two policies:
* * Service account "cluster.local/ns/default/sa/admin" has full access to the service, and so
* does "cluster.local/ns/default/sa/superuser".
* * Any user can read ("GET") the service at paths with prefix "/products", so long as the
* destination port is either 80 or 443.
* .. code-block:: yaml
* action: ALLOW
* policies:
* "service-admin":
* permissions:
* - any: true
* principals:
* - authenticated:
* principal_name:
* exact: "cluster.local/ns/default/sa/admin"
* - authenticated:
* principal_name:
* exact: "cluster.local/ns/default/sa/superuser"
* "product-viewer":
* permissions:
* - and_rules:
* rules:
* - header: { name: ":method", exact_match: "GET" }
* - url_path:
* path: { prefix: "/products" }
* - or_rules:
* rules:
* - destination_port: 80
* - destination_port: 443
* principals:
* - any: true
*
*
* Protobuf type {@code envoy.config.rbac.v2.RBAC}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:envoy.config.rbac.v2.RBAC)
io.envoyproxy.envoy.config.rbac.v2.RBACOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_descriptor;
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 2:
return internalGetPolicies();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMutableMapField(
int number) {
switch (number) {
case 2:
return internalGetMutablePolicies();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.envoyproxy.envoy.config.rbac.v2.RBAC.class, io.envoyproxy.envoy.config.rbac.v2.RBAC.Builder.class);
}
// Construct using io.envoyproxy.envoy.config.rbac.v2.RBAC.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
action_ = 0;
internalGetMutablePolicies().clear();
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.envoyproxy.envoy.config.rbac.v2.RbacProto.internal_static_envoy_config_rbac_v2_RBAC_descriptor;
}
@java.lang.Override
public io.envoyproxy.envoy.config.rbac.v2.RBAC getDefaultInstanceForType() {
return io.envoyproxy.envoy.config.rbac.v2.RBAC.getDefaultInstance();
}
@java.lang.Override
public io.envoyproxy.envoy.config.rbac.v2.RBAC build() {
io.envoyproxy.envoy.config.rbac.v2.RBAC result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public io.envoyproxy.envoy.config.rbac.v2.RBAC buildPartial() {
io.envoyproxy.envoy.config.rbac.v2.RBAC result = new io.envoyproxy.envoy.config.rbac.v2.RBAC(this);
int from_bitField0_ = bitField0_;
result.action_ = action_;
result.policies_ = internalGetPolicies();
result.policies_.makeImmutable();
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.envoyproxy.envoy.config.rbac.v2.RBAC) {
return mergeFrom((io.envoyproxy.envoy.config.rbac.v2.RBAC)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.envoyproxy.envoy.config.rbac.v2.RBAC other) {
if (other == io.envoyproxy.envoy.config.rbac.v2.RBAC.getDefaultInstance()) return this;
if (other.action_ != 0) {
setActionValue(other.getActionValue());
}
internalGetMutablePolicies().mergeFrom(
other.internalGetPolicies());
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.envoyproxy.envoy.config.rbac.v2.RBAC parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.envoyproxy.envoy.config.rbac.v2.RBAC) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int action_ = 0;
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @return The enum numeric value on the wire for action.
*/
@java.lang.Override public int getActionValue() {
return action_;
}
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @param value The enum numeric value on the wire for action to set.
* @return This builder for chaining.
*/
public Builder setActionValue(int value) {
action_ = value;
onChanged();
return this;
}
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @return The action.
*/
@java.lang.Override
public io.envoyproxy.envoy.config.rbac.v2.RBAC.Action getAction() {
@SuppressWarnings("deprecation")
io.envoyproxy.envoy.config.rbac.v2.RBAC.Action result = io.envoyproxy.envoy.config.rbac.v2.RBAC.Action.valueOf(action_);
return result == null ? io.envoyproxy.envoy.config.rbac.v2.RBAC.Action.UNRECOGNIZED : result;
}
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @param value The action to set.
* @return This builder for chaining.
*/
public Builder setAction(io.envoyproxy.envoy.config.rbac.v2.RBAC.Action value) {
if (value == null) {
throw new NullPointerException();
}
action_ = value.getNumber();
onChanged();
return this;
}
/**
*
* The action to take if a policy matches. The request is allowed if and only if:
* * `action` is "ALLOWED" and at least one policy matches
* * `action` is "DENY" and none of the policies match
*
*
* .envoy.config.rbac.v2.RBAC.Action action = 1;
* @return This builder for chaining.
*/
public Builder clearAction() {
action_ = 0;
onChanged();
return this;
}
private com.google.protobuf.MapField<
java.lang.String, io.envoyproxy.envoy.config.rbac.v2.Policy> policies_;
private com.google.protobuf.MapField
internalGetPolicies() {
if (policies_ == null) {
return com.google.protobuf.MapField.emptyMapField(
PoliciesDefaultEntryHolder.defaultEntry);
}
return policies_;
}
private com.google.protobuf.MapField
internalGetMutablePolicies() {
onChanged();;
if (policies_ == null) {
policies_ = com.google.protobuf.MapField.newMapField(
PoliciesDefaultEntryHolder.defaultEntry);
}
if (!policies_.isMutable()) {
policies_ = policies_.copy();
}
return policies_;
}
public int getPoliciesCount() {
return internalGetPolicies().getMap().size();
}
/**
*
* Maps from policy name to policy. A match occurs when at least one policy matches the request.
*
*
* map<string, .envoy.config.rbac.v2.Policy> policies = 2;
*/
@java.lang.Override
public boolean containsPolicies(
java.lang.String key) {
if (key == null) { throw new NullPointerException("map key"); }
return internalGetPolicies().getMap().containsKey(key);
}
/**
* Use {@link #getPoliciesMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map getPolicies() {
return getPoliciesMap();
}
/**
*
* Maps from policy name to policy. A match occurs when at least one policy matches the request.
*