File tree Expand file tree Collapse file tree 16 files changed +120
-120
lines changed
i18n/zh-CN/docusaurus-plugin-content-docs
version-0.10/reference/lang
version-0.4/reference/lang
version-0.5/reference/lang
version-0.6/reference/lang
version-0.7/reference/lang
version-0.8/reference/lang
version-0.9/reference/lang
version-0.10/reference/lang
version-0.4/reference/lang
version-0.5/reference/lang
version-0.6/reference/lang
version-0.7/reference/lang
version-0.8/reference/lang
version-0.9/reference/lang Expand file tree Collapse file tree 16 files changed +120
-120
lines changed Original file line number Diff line number Diff line change @@ -2700,26 +2700,26 @@ We can use protocol to implement type checking of rule structure:
27002700
27012701``` python
27022702# Protocol definition
2703- protocol Service :
2703+ protocol ServiceProtocol :
27042704 clusterIp: str
27052705 $ type : str
27062706
27072707# Protocol definition
2708- protocol Volume :
2709- mountPath: [ str ]
2708+ protocol VolumeProtocol :
2709+ mountPath: str
27102710
27112711# Protocol
27122712protocol SomeProtocol:
27132713 id : int
27142714 env: {str : any }
2715- services: [Service ]
2716- volumes: [Volume ]
2715+ services: [ServiceProtocol ]
2716+ volumes: [VolumeProtocol ]
27172717
27182718rule SomeChecker for SomeProtocol:
27192719 id > 0 , " id must >0"
27202720
27212721 all service in services {
2722- service.clusterIP == " NONE" if service.type == " ClusterIP"
2722+ service.clusterIp == " NONE" if service.type == " ClusterIP"
27232723 }
27242724
27252725 any volume in volumes {
@@ -2735,7 +2735,7 @@ SomeChecker {
27352735 services = [
27362736 {
27372737 type = " ClusterIP"
2738- clusterIP = " NONE"
2738+ clusterIp = " NONE"
27392739 }
27402740 ]
27412741 volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
26332633
26342634``` python
26352635# Protocol definition
2636- protocol Service :
2636+ protocol ServiceProtocol :
26372637 clusterIp: str
26382638 $ type : str
26392639
26402640# Protocol definition
2641- protocol Volume :
2642- mountPath: [ str ]
2641+ protocol VolumeProtocol :
2642+ mountPath: str
26432643
26442644# Protocol
26452645protocol SomeProtocol:
26462646 id : int
26472647 env: {str : any }
2648- services: [Service ]
2649- volumes: [Volume ]
2648+ services: [ServiceProtocol ]
2649+ volumes: [VolumeProtocol ]
26502650
26512651rule SomeChecker for SomeProtocol:
26522652 id > 0 , " id must >0"
26532653
26542654 all service in services {
2655- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26562656 }
26572657
26582658 any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
26682668 services = [
26692669 {
26702670 type = " ClusterIP"
2671- clusterIP = " NONE"
2671+ clusterIp = " NONE"
26722672 }
26732673 ]
26742674 volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
26332633
26342634``` python
26352635# Protocol definition
2636- protocol Service :
2636+ protocol ServiceProtocol :
26372637 clusterIp: str
26382638 $ type : str
26392639
26402640# Protocol definition
2641- protocol Volume :
2642- mountPath: [ str ]
2641+ protocol VolumeProtocol :
2642+ mountPath: str
26432643
26442644# Protocol
26452645protocol SomeProtocol:
26462646 id : int
26472647 env: {str : any }
2648- services: [Service ]
2649- volumes: [Volume ]
2648+ services: [ServiceProtocol ]
2649+ volumes: [VolumeProtocol ]
26502650
26512651rule SomeChecker for SomeProtocol:
26522652 id > 0 , " id must >0"
26532653
26542654 all service in services {
2655- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26562656 }
26572657
26582658 any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
26682668 services = [
26692669 {
26702670 type = " ClusterIP"
2671- clusterIP = " NONE"
2671+ clusterIp = " NONE"
26722672 }
26732673 ]
26742674 volumes = [
Original file line number Diff line number Diff line change @@ -2558,27 +2558,27 @@ rule2 = SomeRule {}
25582558可以使用 protocol 和 for 绑定语句为 rule 增加类型约束:
25592559
25602560``` python
2561- # Schema definition
2562- protocol Service :
2561+ # Protocol definition
2562+ protocol ServiceProtocol :
25632563 clusterIp: str
25642564 $ type : str
25652565
2566- # Schema definition
2567- protocol Volume :
2568- mountPath: [ str ]
2566+ # Protocol definition
2567+ protocol VolumeProtocol :
2568+ mountPath: str
25692569
25702570# Protocol
25712571protocol SomeProtocol:
25722572 id : int
25732573 env: {str : any }
2574- services: [Service ]
2575- volumes: [Volume ]
2574+ services: [ServiceProtocol ]
2575+ volumes: [VolumeProtocol ]
25762576
25772577rule SomeChecker for SomeProtocol:
25782578 id > 0 , " id must >0"
25792579
25802580 all service in services {
2581- service.clusterIP == " NONE" if service.type == " ClusterIP"
2581+ service.clusterIp == " NONE" if service.type == " ClusterIP"
25822582 }
25832583
25842584 any volume in volumes {
@@ -2594,7 +2594,7 @@ SomeChecker {
25942594 services = [
25952595 {
25962596 type = " ClusterIP"
2597- clusterIP = " NONE"
2597+ clusterIp = " NONE"
25982598 }
25992599 ]
26002600 volumes = [
Original file line number Diff line number Diff line change @@ -2567,27 +2567,27 @@ rule2 = SomeRule {}
25672567可以使用 protocol 和 for 绑定语句为 rule 增加类型约束:
25682568
25692569``` python
2570- # Schema definition
2571- protocol Service :
2570+ # Protocol definition
2571+ protocol ServiceProtocol :
25722572 clusterIp: str
25732573 $ type : str
25742574
2575- # Schema definition
2576- protocol Volume :
2577- mountPath: [ str ]
2575+ # Protocol definition
2576+ protocol VolumeProtocol :
2577+ mountPath: str
25782578
25792579# Protocol
25802580protocol SomeProtocol:
25812581 id : int
25822582 env: {str : any }
2583- services: [Service ]
2584- volumes: [Volume ]
2583+ services: [ServiceProtocol ]
2584+ volumes: [VolumeProtocol ]
25852585
25862586rule SomeChecker for SomeProtocol:
25872587 id > 0 , " id must >0"
25882588
25892589 all service in services {
2590- service.clusterIP == " NONE" if service.type == " ClusterIP"
2590+ service.clusterIp == " NONE" if service.type == " ClusterIP"
25912591 }
25922592
25932593 any volume in volumes {
@@ -2603,7 +2603,7 @@ SomeChecker {
26032603 services = [
26042604 {
26052605 type = " ClusterIP"
2606- clusterIP = " NONE"
2606+ clusterIp = " NONE"
26072607 }
26082608 ]
26092609 volumes = [
Original file line number Diff line number Diff line change @@ -2609,26 +2609,26 @@ rule2 = SomeRule {}
26092609
26102610``` python
26112611# Protocol definition
2612- protocol Service :
2612+ protocol ServiceProtocol :
26132613 clusterIp: str
26142614 $ type : str
26152615
26162616# Protocol definition
2617- protocol Volume :
2618- mountPath: [ str ]
2617+ protocol VolumeProtocol :
2618+ mountPath: str
26192619
26202620# Protocol
26212621protocol SomeProtocol:
26222622 id : int
26232623 env: {str : any }
2624- services: [Service ]
2625- volumes: [Volume ]
2624+ services: [ServiceProtocol ]
2625+ volumes: [VolumeProtocol ]
26262626
26272627rule SomeChecker for SomeProtocol:
26282628 id > 0 , " id must >0"
26292629
26302630 all service in services {
2631- service.clusterIP == " NONE" if service.type == " ClusterIP"
2631+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26322632 }
26332633
26342634 any volume in volumes {
@@ -2644,7 +2644,7 @@ SomeChecker {
26442644 services = [
26452645 {
26462646 type = " ClusterIP"
2647- clusterIP = " NONE"
2647+ clusterIp = " NONE"
26482648 }
26492649 ]
26502650 volumes = [
Original file line number Diff line number Diff line change @@ -2623,26 +2623,26 @@ rule2 = SomeRule {}
26232623
26242624``` python
26252625# Protocol definition
2626- protocol Service :
2626+ protocol ServiceProtocol :
26272627 clusterIp: str
26282628 $ type : str
26292629
26302630# Protocol definition
2631- protocol Volume :
2632- mountPath: [ str ]
2631+ protocol VolumeProtocol :
2632+ mountPath: str
26332633
26342634# Protocol
26352635protocol SomeProtocol:
26362636 id : int
26372637 env: {str : any }
2638- services: [Service ]
2639- volumes: [Volume ]
2638+ services: [ServiceProtocol ]
2639+ volumes: [VolumeProtocol ]
26402640
26412641rule SomeChecker for SomeProtocol:
26422642 id > 0 , " id must >0"
26432643
26442644 all service in services {
2645- service.clusterIP == " NONE" if service.type == " ClusterIP"
2645+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26462646 }
26472647
26482648 any volume in volumes {
@@ -2658,7 +2658,7 @@ SomeChecker {
26582658 services = [
26592659 {
26602660 type = " ClusterIP"
2661- clusterIP = " NONE"
2661+ clusterIp = " NONE"
26622662 }
26632663 ]
26642664 volumes = [
Original file line number Diff line number Diff line change @@ -2623,26 +2623,26 @@ rule2 = SomeRule {}
26232623
26242624``` python
26252625# Protocol definition
2626- protocol Service :
2626+ protocol ServiceProtocol :
26272627 clusterIp: str
26282628 $ type : str
26292629
26302630# Protocol definition
2631- protocol Volume :
2632- mountPath: [ str ]
2631+ protocol VolumeProtocol :
2632+ mountPath: str
26332633
26342634# Protocol
26352635protocol SomeProtocol:
26362636 id : int
26372637 env: {str : any }
2638- services: [Service ]
2639- volumes: [Volume ]
2638+ services: [ServiceProtocol ]
2639+ volumes: [VolumeProtocol ]
26402640
26412641rule SomeChecker for SomeProtocol:
26422642 id > 0 , " id must >0"
26432643
26442644 all service in services {
2645- service.clusterIP == " NONE" if service.type == " ClusterIP"
2645+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26462646 }
26472647
26482648 any volume in volumes {
@@ -2658,7 +2658,7 @@ SomeChecker {
26582658 services = [
26592659 {
26602660 type = " ClusterIP"
2661- clusterIP = " NONE"
2661+ clusterIp = " NONE"
26622662 }
26632663 ]
26642664 volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
26332633
26342634``` python
26352635# Protocol definition
2636- protocol Service :
2636+ protocol ServiceProtocol :
26372637 clusterIp: str
26382638 $ type : str
26392639
26402640# Protocol definition
2641- protocol Volume :
2642- mountPath: [ str ]
2641+ protocol VolumeProtocol :
2642+ mountPath: str
26432643
26442644# Protocol
26452645protocol SomeProtocol:
26462646 id : int
26472647 env: {str : any }
2648- services: [Service ]
2649- volumes: [Volume ]
2648+ services: [ServiceProtocol ]
2649+ volumes: [VolumeProtocol ]
26502650
26512651rule SomeChecker for SomeProtocol:
26522652 id > 0 , " id must >0"
26532653
26542654 all service in services {
2655- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655+ service.clusterIp == " NONE" if service.type == " ClusterIP"
26562656 }
26572657
26582658 any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
26682668 services = [
26692669 {
26702670 type = " ClusterIP"
2671- clusterIP = " NONE"
2671+ clusterIp = " NONE"
26722672 }
26732673 ]
26742674 volumes = [
You can’t perform that action at this time.
0 commit comments