# 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.Batch.V1.Model.InstancePolicy do
  @moduledoc """
  InstancePolicy describes an instance type and resources attached to each VM created by this InstancePolicy.

  ## Attributes

  *   `accelerators` (*type:* `list(GoogleApi.Batch.V1.Model.Accelerator.t)`, *default:* `nil`) - The accelerators attached to each VM instance.
  *   `bootDisk` (*type:* `GoogleApi.Batch.V1.Model.Disk.t`, *default:* `nil`) - Boot disk to be created and attached to each VM by this InstancePolicy. Boot disk will be deleted when the VM is deleted. Batch API now only supports booting from image.
  *   `disks` (*type:* `list(GoogleApi.Batch.V1.Model.AttachedDisk.t)`, *default:* `nil`) - Non-boot disks to be attached for each VM created by this InstancePolicy. New disks will be deleted when the VM is deleted. A non-boot disk is a disk that can be of a device with a file system or a raw storage drive that is not ready for data storage and accessing.
  *   `machineType` (*type:* `String.t`, *default:* `nil`) - The Compute Engine machine type.
  *   `minCpuPlatform` (*type:* `String.t`, *default:* `nil`) - The minimum CPU platform. See https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
  *   `provisioningModel` (*type:* `String.t`, *default:* `nil`) - The provisioning model.
  *   `reservation` (*type:* `String.t`, *default:* `nil`) - Optional. If not specified (default), VMs will consume any applicable reservation. If "NO_RESERVATION" is specified, VMs will not consume any reservation. Otherwise, if specified, VMs will consume only the specified reservation.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accelerators => list(GoogleApi.Batch.V1.Model.Accelerator.t()) | nil,
          :bootDisk => GoogleApi.Batch.V1.Model.Disk.t() | nil,
          :disks => list(GoogleApi.Batch.V1.Model.AttachedDisk.t()) | nil,
          :machineType => String.t() | nil,
          :minCpuPlatform => String.t() | nil,
          :provisioningModel => String.t() | nil,
          :reservation => String.t() | nil
        }

  field(:accelerators, as: GoogleApi.Batch.V1.Model.Accelerator, type: :list)
  field(:bootDisk, as: GoogleApi.Batch.V1.Model.Disk)
  field(:disks, as: GoogleApi.Batch.V1.Model.AttachedDisk, type: :list)
  field(:machineType)
  field(:minCpuPlatform)
  field(:provisioningModel)
  field(:reservation)
end

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

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