@@ -922,6 +922,145 @@ WithContainerInstanceAttach<ParentT> withReadOnlyVolumeMountSetting(
922
922
Map <String , String > volumeMountSetting );
923
923
}
924
924
925
+ /**
926
+ * The stage of the container instance definition allowing to specify liveness probe.
927
+ * Azure Container Instances supports liveness probes so that you can configure your containers within your
928
+ * container group to restart if critical functionality is not working.
929
+ *
930
+ * @param <ParentT> the stage of the parent definition to return to after attaching this definition
931
+ */
932
+ interface WithLivenessProbe <ParentT > {
933
+ /**
934
+ * Specifies the container's liveness probe to execute a given command at a given interval.
935
+ * <p>If the probe command execution fails, the container will restart.</p>
936
+ * <p>Only 1 liveness probe can be set for a given container.</p>
937
+ *
938
+ * @param command the command for the probe to execute
939
+ * @param probePeriodSeconds the interval at which the command executes
940
+ * @return the next stage of the definition
941
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-command">liveness command</a>
942
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-probes-and-restart-policies">liveness probes and restart policies</a>
943
+ */
944
+ WithContainerInstanceAttach <ParentT > withLivenessProbeExecutionCommand (List <String > command , int probePeriodSeconds );
945
+
946
+ /**
947
+ * Specifies the container's liveness probe to execute a given command at a given interval.
948
+ * <p>After the probe command execution failure reaches the given threshold, the container will restart.</p>
949
+ * <p>Only 1 liveness probe can be set for a given container.</p>
950
+ *
951
+ * @param command the command for the probe to execute
952
+ * @param probePeriodSeconds the interval at which the command executes
953
+ * @param failureThreshold the consecutive probe failure count before the container restarts
954
+ * @return the next stage of the definition
955
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-command">liveness command</a>
956
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-probes-and-restart-policies">liveness probes and restart policies</a>
957
+ */
958
+ WithContainerInstanceAttach <ParentT > withLivenessProbeExecutionCommand (List <String > command , int probePeriodSeconds , int failureThreshold );
959
+
960
+ /**
961
+ * Specifies the container's liveness probe to perform an Http Get at a given interval.
962
+ * <p>If the probe HTTP GET operation fails with non-200 response, the container will restart.</p>
963
+ * <p>Only 1 liveness probe can be set for a given container.</p>
964
+ *
965
+ * @param path the path to perform the Http Get, starts with "/"
966
+ * @param probePeriodSeconds the interval at which the Http Get performs
967
+ * @param port the port number to probe
968
+ * @return the next stage of the definition
969
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-probes-and-restart-policies">liveness probes and restart policies</a>
970
+ */
971
+ WithContainerInstanceAttach <ParentT > withLivenessProbeHttpGet (String path , int port , int probePeriodSeconds );
972
+
973
+ /**
974
+ * Specifies the container's liveness probe to perform an Http Get at a given interval.
975
+ * <p>After the probe HTTP GET failure with non-200 response reaches the given threshold, the container will restart.</p>
976
+ * <p>Only 1 liveness probe can be set for a given container.</p>
977
+ *
978
+ * @param path the path to perform the Http Get, starts with "/"
979
+ * @param probePeriodSeconds the interval at which the Http Get performs
980
+ * @param port the port number to probe
981
+ * @param failureThreshold the consecutive probe failure count before the container restarts
982
+ * @return the next stage of the definition
983
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-probes-and-restart-policies">liveness probes and restart policies</a>
984
+ */
985
+ WithContainerInstanceAttach <ParentT > withLivenessProbeHttpGet (String path , int port , int probePeriodSeconds , int failureThreshold );
986
+
987
+ /**
988
+ * Specifies the container's liveness probe.
989
+ *
990
+ * @param livenessProbe the liveness probe
991
+ * @return the next stage of the definition
992
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-liveness-probe#liveness-probes-and-restart-policies">liveness probes and restart policies</a>
993
+ */
994
+ WithContainerInstanceAttach <ParentT > withLivenessProbe (ContainerProbe livenessProbe );
995
+ }
996
+
997
+ /**
998
+ * The stage of the container instance definition allowing to specify readiness probe.
999
+ * Azure Container Instances supports readiness probes to include configurations so that your container
1000
+ * can't be accessed under certain conditions.
1001
+ *
1002
+ * @param <ParentT> the stage of the parent definition to return to after attaching this definition
1003
+ */
1004
+ interface WithReadinessProbe <ParentT > {
1005
+ /**
1006
+ * Specifies the container's readiness probe to execute a given command at a given interval.
1007
+ * <p>If the probe command execution fails, the container will continue to run but can't be accessed.</p>
1008
+ * <p>Only 1 readiness probe can be set for a given container.</p>
1009
+ *
1010
+ * @param command the command for the probe to execute
1011
+ * @param probePeriodSeconds the interval at which the command executes
1012
+ * @return the next stage of the definition
1013
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-readiness-probe#readiness-command">readiness command</a>
1014
+ */
1015
+ WithContainerInstanceAttach <ParentT > withReadinessProbeExecutionCommand (List <String > command , int probePeriodSeconds );
1016
+
1017
+ /**
1018
+ * Specifies the container's readiness probe to execute a given command at a given interval.
1019
+ * <p>After the probe command execution failure reaches the given threshold, the container will continue to run but can't be accessed.</p>
1020
+ * <p>Only 1 readiness probe can be set for a given container.</p>
1021
+ *
1022
+ * @param command the command for the probe to execute
1023
+ * @param probePeriodSeconds the interval at which the command executes
1024
+ * @param failureThreshold the consecutive probe failure count before the container becomes inaccessible
1025
+ * @return the next stage of the definition
1026
+ * @see <a href="https://learn.microsoft.com/en-us/azure/container-instances/container-instances-readiness-probe#readiness-command">readiness command</a>
1027
+ */
1028
+ WithContainerInstanceAttach <ParentT > withReadinessProbeExecutionCommand (List <String > command , int probePeriodSeconds , int failureThreshold );
1029
+
1030
+ /**
1031
+ * Specifies the container's readiness probe to perform an Http Get at a given interval.
1032
+ * <p>If the probe HTTP GET operation fails with non-200 response, the container will continue to run but can't be accessed.</p>
1033
+ * <p>Only 1 readiness probe can be set for a given container.</p>
1034
+ *
1035
+ * @param path the path to perform the Http Get, starts with "/"
1036
+ * @param port the port number to probe
1037
+ * @param probePeriodSeconds the interval at which the Http Get performs
1038
+ * @return the next stage of the definition
1039
+ */
1040
+ WithContainerInstanceAttach <ParentT > withReadinessProbeHttpGet (String path , int port , int probePeriodSeconds );
1041
+
1042
+ /**
1043
+ * Specifies the container's readiness probe to perform an Http Get at a given interval.
1044
+ * <p>After the probe HTTP GET failure with non-200 response reaches the given threshold, the container will continue to run but can't be accessed.</p>
1045
+ * <p>Only 1 readiness probe can be set for a given container.</p>
1046
+ *
1047
+ * @param path the path to perform the Http Get, starts with "/"
1048
+ * @param port the port number to probe
1049
+ * @param probePeriodSeconds the interval at which the Http Get performs
1050
+ * @param failureThreshold the consecutive probe failure count before the container becomes inaccessible
1051
+ * @return the next stage of the definition
1052
+ */
1053
+ WithContainerInstanceAttach <ParentT > withReadinessProbeHttpGet (String path , int port , int probePeriodSeconds , int failureThreshold );
1054
+
1055
+ /**
1056
+ * Specifies the container's readiness probe.
1057
+ *
1058
+ * @param readinessProbe the readiness probe
1059
+ * @return the next stage of the definition
1060
+ */
1061
+ WithContainerInstanceAttach <ParentT > withReadinessProbe (ContainerProbe readinessProbe );
1062
+ }
1063
+
925
1064
/**
926
1065
* The final stage of the container instance definition.
927
1066
*
@@ -937,6 +1076,8 @@ interface WithContainerInstanceAttach<ParentT>
937
1076
WithStartingCommandLine <ParentT >,
938
1077
WithEnvironmentVariables <ParentT >,
939
1078
WithVolumeMountSetting <ParentT >,
1079
+ WithLivenessProbe <ParentT >,
1080
+ WithReadinessProbe <ParentT >,
940
1081
Attachable .InDefinition <ParentT > {
941
1082
}
942
1083
0 commit comments