<?php
/*
 * Copyright 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

namespace Google\Service\Compute;

class InstanceGroupManagerInstanceLifecyclePolicy extends \Google\Model
{
  /**
   * MIG does not repair a failed VM.
   */
  public const DEFAULT_ACTION_ON_FAILURE_DO_NOTHING = 'DO_NOTHING';
  /**
   * (default): MIG automatically repairs a failed VM by recreating it. For more
   * information, see About repairing VMs in a MIG.
   */
  public const DEFAULT_ACTION_ON_FAILURE_REPAIR = 'REPAIR';
  public const FORCE_UPDATE_ON_REPAIR_NO = 'NO';
  public const FORCE_UPDATE_ON_REPAIR_YES = 'YES';
  /**
   * (Default) MIG uses the same action configured for
   * instanceLifecyclePolicy.defaultActionOnFailure field.
   */
  public const ON_FAILED_HEALTH_CHECK_DEFAULT_ACTION = 'DEFAULT_ACTION';
  /**
   * MIG doesn't repair an unhealthy VM.
   */
  public const ON_FAILED_HEALTH_CHECK_DO_NOTHING = 'DO_NOTHING';
  /**
   * MIG automatically repairs an unhealthy VM by recreating it.
   */
  public const ON_FAILED_HEALTH_CHECK_REPAIR = 'REPAIR';
  /**
   * The action that a MIG performs on a failed VM. If the value of the
   * onFailedHealthCheck field is `DEFAULT_ACTION`, then the same action also
   * applies to the VMs on which your application fails a health check. Valid
   * values are         - REPAIR (default): MIG automatically repairs a failed
   * VM    by recreating it. For more information, see About    repairing VMs in
   * a MIG.    - DO_NOTHING: MIG does not repair a failed VM.
   *
   * @var string
   */
  public $defaultActionOnFailure;
  /**
   * A bit indicating whether to forcefully apply the group's latest
   * configuration when repairing a VM. Valid options are:
   *
   *              -  NO (default): If configuration updates are available, they
   * are not      forcefully applied during repair. Instead, configuration
   * updates are      applied according to the group's update policy.          -
   * YES: If configuration updates are available, they are applied      during
   * repair.
   *
   * @var string
   */
  public $forceUpdateOnRepair;
  /**
   * The action that a MIG performs on an unhealthy VM. A VM is marked as
   * unhealthy when the application running on that VM fails a health check.
   * Valid values are:        - DEFAULT_ACTION (default): MIG uses the same
   * action    configured for instanceLifecyclePolicy.defaultActionOnFailure
   * field.    - REPAIR: MIG automatically repairs an unhealthy VM by
   * recreating it.    - DO_NOTHING: MIG doesn't repair an unhealthy VM.    For
   * more information, see     About repairing VMs in a MIG.
   *
   * @var string
   */
  public $onFailedHealthCheck;
  protected $onRepairType = InstanceGroupManagerInstanceLifecyclePolicyOnRepair::class;
  protected $onRepairDataType = '';

  /**
   * The action that a MIG performs on a failed VM. If the value of the
   * onFailedHealthCheck field is `DEFAULT_ACTION`, then the same action also
   * applies to the VMs on which your application fails a health check. Valid
   * values are         - REPAIR (default): MIG automatically repairs a failed
   * VM    by recreating it. For more information, see About    repairing VMs in
   * a MIG.    - DO_NOTHING: MIG does not repair a failed VM.
   *
   * Accepted values: DO_NOTHING, REPAIR
   *
   * @param self::DEFAULT_ACTION_ON_FAILURE_* $defaultActionOnFailure
   */
  public function setDefaultActionOnFailure($defaultActionOnFailure)
  {
    $this->defaultActionOnFailure = $defaultActionOnFailure;
  }
  /**
   * @return self::DEFAULT_ACTION_ON_FAILURE_*
   */
  public function getDefaultActionOnFailure()
  {
    return $this->defaultActionOnFailure;
  }
  /**
   * A bit indicating whether to forcefully apply the group's latest
   * configuration when repairing a VM. Valid options are:
   *
   *              -  NO (default): If configuration updates are available, they
   * are not      forcefully applied during repair. Instead, configuration
   * updates are      applied according to the group's update policy.          -
   * YES: If configuration updates are available, they are applied      during
   * repair.
   *
   * Accepted values: NO, YES
   *
   * @param self::FORCE_UPDATE_ON_REPAIR_* $forceUpdateOnRepair
   */
  public function setForceUpdateOnRepair($forceUpdateOnRepair)
  {
    $this->forceUpdateOnRepair = $forceUpdateOnRepair;
  }
  /**
   * @return self::FORCE_UPDATE_ON_REPAIR_*
   */
  public function getForceUpdateOnRepair()
  {
    return $this->forceUpdateOnRepair;
  }
  /**
   * The action that a MIG performs on an unhealthy VM. A VM is marked as
   * unhealthy when the application running on that VM fails a health check.
   * Valid values are:        - DEFAULT_ACTION (default): MIG uses the same
   * action    configured for instanceLifecyclePolicy.defaultActionOnFailure
   * field.    - REPAIR: MIG automatically repairs an unhealthy VM by
   * recreating it.    - DO_NOTHING: MIG doesn't repair an unhealthy VM.    For
   * more information, see     About repairing VMs in a MIG.
   *
   * Accepted values: DEFAULT_ACTION, DO_NOTHING, REPAIR
   *
   * @param self::ON_FAILED_HEALTH_CHECK_* $onFailedHealthCheck
   */
  public function setOnFailedHealthCheck($onFailedHealthCheck)
  {
    $this->onFailedHealthCheck = $onFailedHealthCheck;
  }
  /**
   * @return self::ON_FAILED_HEALTH_CHECK_*
   */
  public function getOnFailedHealthCheck()
  {
    return $this->onFailedHealthCheck;
  }
  /**
   * Configuration for VM repairs in the MIG.
   *
   * @param InstanceGroupManagerInstanceLifecyclePolicyOnRepair $onRepair
   */
  public function setOnRepair(InstanceGroupManagerInstanceLifecyclePolicyOnRepair $onRepair)
  {
    $this->onRepair = $onRepair;
  }
  /**
   * @return InstanceGroupManagerInstanceLifecyclePolicyOnRepair
   */
  public function getOnRepair()
  {
    return $this->onRepair;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(InstanceGroupManagerInstanceLifecyclePolicy::class, 'Google_Service_Compute_InstanceGroupManagerInstanceLifecyclePolicy');
