/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.osconfig.v1.model;

/**
 * Patch rollout configuration specifications. Contains details on the concurrency control when
 * applying patch(es) to all targeted VMs.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the OS Config API. For a detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class PatchRollout extends com.google.api.client.json.GenericJson {

  /**
   * The maximum number (or percentage) of VMs per zone to disrupt at any given moment. The number
   * of VMs calculated from multiplying the percentage by the total number of VMs in a zone is
   * rounded up. During patching, a VM is considered disrupted from the time the agent is notified
   * to begin until patching has completed. This disruption time includes the time to complete
   * reboot and any post-patch steps. A VM contributes to the disruption budget if its patching
   * operation fails either when applying the patches, running pre or post patch steps, or if it
   * fails to respond with a success notification before timing out. VMs that are not running or do
   * not have an active agent do not count toward this disruption budget. For zone-by-zone rollouts,
   * if the disruption budget in a zone is exceeded, the patch job stops, because continuing to the
   * next zone requires completion of the patch process in the previous zone. For example, if the
   * disruption budget has a fixed value of `10`, and 8 VMs fail to patch in the current zone, the
   * patch job continues to patch 2 VMs at a time until the zone is completed. When that zone is
   * completed successfully, patching begins with 10 VMs at a time in the next zone. If 10 VMs in
   * the next zone fail to patch, the patch job stops.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private FixedOrPercent disruptionBudget;

  /**
   * Mode of the patch rollout.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String mode;

  /**
   * The maximum number (or percentage) of VMs per zone to disrupt at any given moment. The number
   * of VMs calculated from multiplying the percentage by the total number of VMs in a zone is
   * rounded up. During patching, a VM is considered disrupted from the time the agent is notified
   * to begin until patching has completed. This disruption time includes the time to complete
   * reboot and any post-patch steps. A VM contributes to the disruption budget if its patching
   * operation fails either when applying the patches, running pre or post patch steps, or if it
   * fails to respond with a success notification before timing out. VMs that are not running or do
   * not have an active agent do not count toward this disruption budget. For zone-by-zone rollouts,
   * if the disruption budget in a zone is exceeded, the patch job stops, because continuing to the
   * next zone requires completion of the patch process in the previous zone. For example, if the
   * disruption budget has a fixed value of `10`, and 8 VMs fail to patch in the current zone, the
   * patch job continues to patch 2 VMs at a time until the zone is completed. When that zone is
   * completed successfully, patching begins with 10 VMs at a time in the next zone. If 10 VMs in
   * the next zone fail to patch, the patch job stops.
   * @return value or {@code null} for none
   */
  public FixedOrPercent getDisruptionBudget() {
    return disruptionBudget;
  }

  /**
   * The maximum number (or percentage) of VMs per zone to disrupt at any given moment. The number
   * of VMs calculated from multiplying the percentage by the total number of VMs in a zone is
   * rounded up. During patching, a VM is considered disrupted from the time the agent is notified
   * to begin until patching has completed. This disruption time includes the time to complete
   * reboot and any post-patch steps. A VM contributes to the disruption budget if its patching
   * operation fails either when applying the patches, running pre or post patch steps, or if it
   * fails to respond with a success notification before timing out. VMs that are not running or do
   * not have an active agent do not count toward this disruption budget. For zone-by-zone rollouts,
   * if the disruption budget in a zone is exceeded, the patch job stops, because continuing to the
   * next zone requires completion of the patch process in the previous zone. For example, if the
   * disruption budget has a fixed value of `10`, and 8 VMs fail to patch in the current zone, the
   * patch job continues to patch 2 VMs at a time until the zone is completed. When that zone is
   * completed successfully, patching begins with 10 VMs at a time in the next zone. If 10 VMs in
   * the next zone fail to patch, the patch job stops.
   * @param disruptionBudget disruptionBudget or {@code null} for none
   */
  public PatchRollout setDisruptionBudget(FixedOrPercent disruptionBudget) {
    this.disruptionBudget = disruptionBudget;
    return this;
  }

  /**
   * Mode of the patch rollout.
   * @return value or {@code null} for none
   */
  public java.lang.String getMode() {
    return mode;
  }

  /**
   * Mode of the patch rollout.
   * @param mode mode or {@code null} for none
   */
  public PatchRollout setMode(java.lang.String mode) {
    this.mode = mode;
    return this;
  }

  @Override
  public PatchRollout set(String fieldName, Object value) {
    return (PatchRollout) super.set(fieldName, value);
  }

  @Override
  public PatchRollout clone() {
    return (PatchRollout) super.clone();
  }

}
