public MachineHealthCheckScriptPolicy ToModel()
 {
     if (RunType == MachineScriptPolicyRunType.Unspecified || RunType == MachineScriptPolicyRunType.InheritFromDefault)
     {
         return(MachineHealthCheckScriptPolicy.InheritFromDefault());
     }
     return(MachineHealthCheckScriptPolicy.Inline(ScriptBody));
 }
Example #2
0
        private static MachineHealthCheckScriptPolicy ToScriptPolicy(Octopus.Client.Model.MachineScriptPolicy machineScriptPolicy)
        {
            if (machineScriptPolicy.RunType == Octopus.Client.Model.MachineScriptPolicyRunType.InheritFromDefault)
            {
                return(MachineHealthCheckScriptPolicy.InheritFromDefault());
            }
            if (machineScriptPolicy.RunType == Octopus.Client.Model.MachineScriptPolicyRunType.Inline)
            {
                return(MachineHealthCheckScriptPolicy.Inline(machineScriptPolicy.ScriptBody));
            }

            throw new InvalidOperationException($"Unsupported {nameof(Octopus.Client.Model.MachineScriptPolicy)}");
        }