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:
2700
2700
2701
2701
``` python
2702
2702
# Protocol definition
2703
- protocol Service :
2703
+ protocol ServiceProtocol :
2704
2704
clusterIp: str
2705
2705
$ type : str
2706
2706
2707
2707
# Protocol definition
2708
- protocol Volume :
2709
- mountPath: [ str ]
2708
+ protocol VolumeProtocol :
2709
+ mountPath: str
2710
2710
2711
2711
# Protocol
2712
2712
protocol SomeProtocol:
2713
2713
id : int
2714
2714
env: {str : any }
2715
- services: [Service ]
2716
- volumes: [Volume ]
2715
+ services: [ServiceProtocol ]
2716
+ volumes: [VolumeProtocol ]
2717
2717
2718
2718
rule SomeChecker for SomeProtocol:
2719
2719
id > 0 , " id must >0"
2720
2720
2721
2721
all service in services {
2722
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2722
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2723
2723
}
2724
2724
2725
2725
any volume in volumes {
@@ -2735,7 +2735,7 @@ SomeChecker {
2735
2735
services = [
2736
2736
{
2737
2737
type = " ClusterIP"
2738
- clusterIP = " NONE"
2738
+ clusterIp = " NONE"
2739
2739
}
2740
2740
]
2741
2741
volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
2633
2633
2634
2634
``` python
2635
2635
# Protocol definition
2636
- protocol Service :
2636
+ protocol ServiceProtocol :
2637
2637
clusterIp: str
2638
2638
$ type : str
2639
2639
2640
2640
# Protocol definition
2641
- protocol Volume :
2642
- mountPath: [ str ]
2641
+ protocol VolumeProtocol :
2642
+ mountPath: str
2643
2643
2644
2644
# Protocol
2645
2645
protocol SomeProtocol:
2646
2646
id : int
2647
2647
env: {str : any }
2648
- services: [Service ]
2649
- volumes: [Volume ]
2648
+ services: [ServiceProtocol ]
2649
+ volumes: [VolumeProtocol ]
2650
2650
2651
2651
rule SomeChecker for SomeProtocol:
2652
2652
id > 0 , " id must >0"
2653
2653
2654
2654
all service in services {
2655
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2656
2656
}
2657
2657
2658
2658
any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
2668
2668
services = [
2669
2669
{
2670
2670
type = " ClusterIP"
2671
- clusterIP = " NONE"
2671
+ clusterIp = " NONE"
2672
2672
}
2673
2673
]
2674
2674
volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
2633
2633
2634
2634
``` python
2635
2635
# Protocol definition
2636
- protocol Service :
2636
+ protocol ServiceProtocol :
2637
2637
clusterIp: str
2638
2638
$ type : str
2639
2639
2640
2640
# Protocol definition
2641
- protocol Volume :
2642
- mountPath: [ str ]
2641
+ protocol VolumeProtocol :
2642
+ mountPath: str
2643
2643
2644
2644
# Protocol
2645
2645
protocol SomeProtocol:
2646
2646
id : int
2647
2647
env: {str : any }
2648
- services: [Service ]
2649
- volumes: [Volume ]
2648
+ services: [ServiceProtocol ]
2649
+ volumes: [VolumeProtocol ]
2650
2650
2651
2651
rule SomeChecker for SomeProtocol:
2652
2652
id > 0 , " id must >0"
2653
2653
2654
2654
all service in services {
2655
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2656
2656
}
2657
2657
2658
2658
any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
2668
2668
services = [
2669
2669
{
2670
2670
type = " ClusterIP"
2671
- clusterIP = " NONE"
2671
+ clusterIp = " NONE"
2672
2672
}
2673
2673
]
2674
2674
volumes = [
Original file line number Diff line number Diff line change @@ -2558,27 +2558,27 @@ rule2 = SomeRule {}
2558
2558
可以使用 protocol 和 for 绑定语句为 rule 增加类型约束:
2559
2559
2560
2560
``` python
2561
- # Schema definition
2562
- protocol Service :
2561
+ # Protocol definition
2562
+ protocol ServiceProtocol :
2563
2563
clusterIp: str
2564
2564
$ type : str
2565
2565
2566
- # Schema definition
2567
- protocol Volume :
2568
- mountPath: [ str ]
2566
+ # Protocol definition
2567
+ protocol VolumeProtocol :
2568
+ mountPath: str
2569
2569
2570
2570
# Protocol
2571
2571
protocol SomeProtocol:
2572
2572
id : int
2573
2573
env: {str : any }
2574
- services: [Service ]
2575
- volumes: [Volume ]
2574
+ services: [ServiceProtocol ]
2575
+ volumes: [VolumeProtocol ]
2576
2576
2577
2577
rule SomeChecker for SomeProtocol:
2578
2578
id > 0 , " id must >0"
2579
2579
2580
2580
all service in services {
2581
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2581
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2582
2582
}
2583
2583
2584
2584
any volume in volumes {
@@ -2594,7 +2594,7 @@ SomeChecker {
2594
2594
services = [
2595
2595
{
2596
2596
type = " ClusterIP"
2597
- clusterIP = " NONE"
2597
+ clusterIp = " NONE"
2598
2598
}
2599
2599
]
2600
2600
volumes = [
Original file line number Diff line number Diff line change @@ -2567,27 +2567,27 @@ rule2 = SomeRule {}
2567
2567
可以使用 protocol 和 for 绑定语句为 rule 增加类型约束:
2568
2568
2569
2569
``` python
2570
- # Schema definition
2571
- protocol Service :
2570
+ # Protocol definition
2571
+ protocol ServiceProtocol :
2572
2572
clusterIp: str
2573
2573
$ type : str
2574
2574
2575
- # Schema definition
2576
- protocol Volume :
2577
- mountPath: [ str ]
2575
+ # Protocol definition
2576
+ protocol VolumeProtocol :
2577
+ mountPath: str
2578
2578
2579
2579
# Protocol
2580
2580
protocol SomeProtocol:
2581
2581
id : int
2582
2582
env: {str : any }
2583
- services: [Service ]
2584
- volumes: [Volume ]
2583
+ services: [ServiceProtocol ]
2584
+ volumes: [VolumeProtocol ]
2585
2585
2586
2586
rule SomeChecker for SomeProtocol:
2587
2587
id > 0 , " id must >0"
2588
2588
2589
2589
all service in services {
2590
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2590
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2591
2591
}
2592
2592
2593
2593
any volume in volumes {
@@ -2603,7 +2603,7 @@ SomeChecker {
2603
2603
services = [
2604
2604
{
2605
2605
type = " ClusterIP"
2606
- clusterIP = " NONE"
2606
+ clusterIp = " NONE"
2607
2607
}
2608
2608
]
2609
2609
volumes = [
Original file line number Diff line number Diff line change @@ -2609,26 +2609,26 @@ rule2 = SomeRule {}
2609
2609
2610
2610
``` python
2611
2611
# Protocol definition
2612
- protocol Service :
2612
+ protocol ServiceProtocol :
2613
2613
clusterIp: str
2614
2614
$ type : str
2615
2615
2616
2616
# Protocol definition
2617
- protocol Volume :
2618
- mountPath: [ str ]
2617
+ protocol VolumeProtocol :
2618
+ mountPath: str
2619
2619
2620
2620
# Protocol
2621
2621
protocol SomeProtocol:
2622
2622
id : int
2623
2623
env: {str : any }
2624
- services: [Service ]
2625
- volumes: [Volume ]
2624
+ services: [ServiceProtocol ]
2625
+ volumes: [VolumeProtocol ]
2626
2626
2627
2627
rule SomeChecker for SomeProtocol:
2628
2628
id > 0 , " id must >0"
2629
2629
2630
2630
all service in services {
2631
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2631
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2632
2632
}
2633
2633
2634
2634
any volume in volumes {
@@ -2644,7 +2644,7 @@ SomeChecker {
2644
2644
services = [
2645
2645
{
2646
2646
type = " ClusterIP"
2647
- clusterIP = " NONE"
2647
+ clusterIp = " NONE"
2648
2648
}
2649
2649
]
2650
2650
volumes = [
Original file line number Diff line number Diff line change @@ -2623,26 +2623,26 @@ rule2 = SomeRule {}
2623
2623
2624
2624
``` python
2625
2625
# Protocol definition
2626
- protocol Service :
2626
+ protocol ServiceProtocol :
2627
2627
clusterIp: str
2628
2628
$ type : str
2629
2629
2630
2630
# Protocol definition
2631
- protocol Volume :
2632
- mountPath: [ str ]
2631
+ protocol VolumeProtocol :
2632
+ mountPath: str
2633
2633
2634
2634
# Protocol
2635
2635
protocol SomeProtocol:
2636
2636
id : int
2637
2637
env: {str : any }
2638
- services: [Service ]
2639
- volumes: [Volume ]
2638
+ services: [ServiceProtocol ]
2639
+ volumes: [VolumeProtocol ]
2640
2640
2641
2641
rule SomeChecker for SomeProtocol:
2642
2642
id > 0 , " id must >0"
2643
2643
2644
2644
all service in services {
2645
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2645
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2646
2646
}
2647
2647
2648
2648
any volume in volumes {
@@ -2658,7 +2658,7 @@ SomeChecker {
2658
2658
services = [
2659
2659
{
2660
2660
type = " ClusterIP"
2661
- clusterIP = " NONE"
2661
+ clusterIp = " NONE"
2662
2662
}
2663
2663
]
2664
2664
volumes = [
Original file line number Diff line number Diff line change @@ -2623,26 +2623,26 @@ rule2 = SomeRule {}
2623
2623
2624
2624
``` python
2625
2625
# Protocol definition
2626
- protocol Service :
2626
+ protocol ServiceProtocol :
2627
2627
clusterIp: str
2628
2628
$ type : str
2629
2629
2630
2630
# Protocol definition
2631
- protocol Volume :
2632
- mountPath: [ str ]
2631
+ protocol VolumeProtocol :
2632
+ mountPath: str
2633
2633
2634
2634
# Protocol
2635
2635
protocol SomeProtocol:
2636
2636
id : int
2637
2637
env: {str : any }
2638
- services: [Service ]
2639
- volumes: [Volume ]
2638
+ services: [ServiceProtocol ]
2639
+ volumes: [VolumeProtocol ]
2640
2640
2641
2641
rule SomeChecker for SomeProtocol:
2642
2642
id > 0 , " id must >0"
2643
2643
2644
2644
all service in services {
2645
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2645
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2646
2646
}
2647
2647
2648
2648
any volume in volumes {
@@ -2658,7 +2658,7 @@ SomeChecker {
2658
2658
services = [
2659
2659
{
2660
2660
type = " ClusterIP"
2661
- clusterIP = " NONE"
2661
+ clusterIp = " NONE"
2662
2662
}
2663
2663
]
2664
2664
volumes = [
Original file line number Diff line number Diff line change @@ -2633,26 +2633,26 @@ rule2 = SomeRule {}
2633
2633
2634
2634
``` python
2635
2635
# Protocol definition
2636
- protocol Service :
2636
+ protocol ServiceProtocol :
2637
2637
clusterIp: str
2638
2638
$ type : str
2639
2639
2640
2640
# Protocol definition
2641
- protocol Volume :
2642
- mountPath: [ str ]
2641
+ protocol VolumeProtocol :
2642
+ mountPath: str
2643
2643
2644
2644
# Protocol
2645
2645
protocol SomeProtocol:
2646
2646
id : int
2647
2647
env: {str : any }
2648
- services: [Service ]
2649
- volumes: [Volume ]
2648
+ services: [ServiceProtocol ]
2649
+ volumes: [VolumeProtocol ]
2650
2650
2651
2651
rule SomeChecker for SomeProtocol:
2652
2652
id > 0 , " id must >0"
2653
2653
2654
2654
all service in services {
2655
- service.clusterIP == " NONE" if service.type == " ClusterIP"
2655
+ service.clusterIp == " NONE" if service.type == " ClusterIP"
2656
2656
}
2657
2657
2658
2658
any volume in volumes {
@@ -2668,7 +2668,7 @@ SomeChecker {
2668
2668
services = [
2669
2669
{
2670
2670
type = " ClusterIP"
2671
- clusterIP = " NONE"
2671
+ clusterIp = " NONE"
2672
2672
}
2673
2673
]
2674
2674
volumes = [
You can’t perform that action at this time.
0 commit comments