# 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.Workstations.V1.Model.BoostConfig do
  @moduledoc """
  A boost configuration is a set of resources that a workstation can use to increase its performance. If you specify a boost configuration, upon startup, workstation users can choose to use a VM provisioned under the boost config by passing the boost config ID in the start request. If the workstation user does not provide a boost config ID in the start request, the system will choose a VM from the pool provisioned under the default config.

  ## Attributes

  *   `accelerators` (*type:* `list(GoogleApi.Workstations.V1.Model.Accelerator.t)`, *default:* `nil`) - Optional. A list of the type and count of accelerator cards attached to the boost instance. Defaults to `none`.
  *   `bootDiskSizeGb` (*type:* `integer()`, *default:* `nil`) - Optional. The size of the boot disk for the VM in gigabytes (GB). The minimum boot disk size is `30` GB. Defaults to `50` GB.
  *   `enableNestedVirtualization` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether to enable nested virtualization on boosted Cloud Workstations VMs running using this boost configuration. Defaults to false. Nested virtualization lets you run virtual machine (VM) instances inside your workstation. Before enabling nested virtualization, consider the following important considerations. Cloud Workstations instances are subject to the [same restrictions as Compute Engine instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions): * **Organization policy**: projects, folders, or organizations may be restricted from creating nested VMs if the **Disable VM nested virtualization** constraint is enforced in the organization policy. For more information, see the Compute Engine section, [Checking whether nested virtualization is allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed). * **Performance**: nested VMs might experience a 10% or greater decrease in performance for workloads that are CPU-bound and possibly greater than a 10% decrease for workloads that are input/output bound. * **Machine Type**: nested virtualization can only be enabled on boost configurations that specify a machine_type in the N1 or N2 machine series.
  *   `id` (*type:* `String.t`, *default:* `nil`) - Required. The ID to be used for the boost configuration.
  *   `machineType` (*type:* `String.t`, *default:* `nil`) - Optional. The type of machine that boosted VM instances will use—for example, `e2-standard-4`. For more information about machine types that Cloud Workstations supports, see the list of [available machine types](https://cloud.google.com/workstations/docs/available-machine-types). Defaults to `e2-standard-4`.
  *   `poolSize` (*type:* `integer()`, *default:* `nil`) - Optional. The number of boost VMs that the system should keep idle so that workstations can be boosted quickly. Defaults to `0`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accelerators => list(GoogleApi.Workstations.V1.Model.Accelerator.t()) | nil,
          :bootDiskSizeGb => integer() | nil,
          :enableNestedVirtualization => boolean() | nil,
          :id => String.t() | nil,
          :machineType => String.t() | nil,
          :poolSize => integer() | nil
        }

  field(:accelerators, as: GoogleApi.Workstations.V1.Model.Accelerator, type: :list)
  field(:bootDiskSizeGb)
  field(:enableNestedVirtualization)
  field(:id)
  field(:machineType)
  field(:poolSize)
end

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

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