# Copyright 2019 Google LLC
#
# 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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VMMigration.V1.Model.ComputeScheduling do
  @moduledoc """
  Scheduling information for VM on maintenance/restart behaviour and node allocation in sole tenant nodes. Options for instance behavior when the host machine undergoes maintenance that may temporarily impact instance performance.

  ## Attributes

  *   `minNodeCpus` (*type:* `integer()`, *default:* `nil`) - The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node. Ignored if no node_affinites are configured.
  *   `nodeAffinities` (*type:* `list(GoogleApi.VMMigration.V1.Model.SchedulingNodeAffinity.t)`, *default:* `nil`) - A set of node affinity and anti-affinity configurations for sole tenant nodes.
  *   `onHostMaintenance` (*type:* `String.t`, *default:* `nil`) - How the instance should behave when the host machine undergoes maintenance that may temporarily impact instance performance.
  *   `restartType` (*type:* `String.t`, *default:* `nil`) - Whether the Instance should be automatically restarted whenever it is terminated by Compute Engine (not terminated by user). This configuration is identical to `automaticRestart` field in Compute Engine create instance under scheduling. It was changed to an enum (instead of a boolean) to match the default value in Compute Engine which is automatic restart.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :minNodeCpus => integer() | nil,
          :nodeAffinities =>
            list(GoogleApi.VMMigration.V1.Model.SchedulingNodeAffinity.t()) | nil,
          :onHostMaintenance => String.t() | nil,
          :restartType => String.t() | nil
        }

  field(:minNodeCpus)
  field(:nodeAffinities, as: GoogleApi.VMMigration.V1.Model.SchedulingNodeAffinity, type: :list)
  field(:onHostMaintenance)
  field(:restartType)
end

defimpl Poison.Decoder, for: GoogleApi.VMMigration.V1.Model.ComputeScheduling do
  def decode(value, options) do
    GoogleApi.VMMigration.V1.Model.ComputeScheduling.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VMMigration.V1.Model.ComputeScheduling do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
