File: policy.proto

package info (click to toggle)
singularity-container 4.1.5%2Bds4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 43,876 kB
  • sloc: asm: 14,840; sh: 3,190; ansic: 1,751; awk: 414; makefile: 413; python: 99
file content (64 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
syntax = "proto3";

package moby.buildkit.v1.sourcepolicy;

// Rule defines the action(s) to take when a source is matched
message Rule {
	PolicyAction action = 1; 
	Selector selector = 2;
	Update updates = 3;
}

// Update contains updates to the matched build step after rule is applied
message Update {
	string identifier = 1;
	map<string, string> attrs = 2;
}

// Selector identifies a source to match a policy to
message Selector {
	string identifier = 1;
	// MatchType is the type of match to perform on the source identifier
	MatchType match_type = 2;
	repeated AttrConstraint constraints = 3;
}

// PolicyAction defines the action to take when a source is matched
enum PolicyAction {
	ALLOW = 0;
	DENY = 1;
	CONVERT = 2;
}

// AttrConstraint defines a constraint on a source attribute
message AttrConstraint {
	string key = 1;
	string value = 2;
	AttrMatch condition = 3;
}

// AttrMatch defines the condition to match a source attribute
enum AttrMatch {
	EQUAL = 0;
	NOTEQUAL = 1;
	MATCHES = 2;
}

// Policy is the list of rules the policy engine will perform
message Policy {
	int64 version = 1; // Currently 1
	repeated Rule rules = 2;
}

// Match type is used to determine how a rule source is matched
enum MatchType {
	// WILDCARD is the default matching type.
	// It may first attempt to due an exact match but will follow up with a wildcard match
	// For something more powerful, use REGEX
	WILDCARD = 0;
	// EXACT treats the source identifier as a litteral string match
	EXACT = 1;
	// REGEX treats the source identifier as a regular expression
	// With regex matching you can also use match groups to replace values in the destination identifier
	REGEX = 2;
}