# 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.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig do
  @moduledoc """
  Defines the configuration to be used for creating workers in the worker pool.

  ## Attributes

  *   `accelerator` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaAcceleratorConfig.t`, *default:* `nil`) - The accelerator card attached to each VM.
  *   `diskSizeGb` (*type:* `String.t`, *default:* `nil`) - Required. Size of the disk attached to the worker, in GB. See https://cloud.google.com/compute/docs/disks/
  *   `diskType` (*type:* `String.t`, *default:* `nil`) - Required. Disk Type to use for the worker. See [Storage options](https://cloud.google.com/compute/docs/disks/#introduction). Currently only `pd-standard` and `pd-ssd` are supported.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels associated with the workers. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International letters are permitted. Label keys must start with a letter. Label values are optional. There can not be more than 64 labels per resource.
  *   `machineType` (*type:* `String.t`, *default:* `nil`) - Required. Machine type of the worker, such as `e2-standard-2`. See https://cloud.google.com/compute/docs/machine-types for a list of supported machine types. Note that `f1-micro` and `g1-small` are not yet supported.
  *   `maxConcurrentActions` (*type:* `String.t`, *default:* `nil`) - The maximum number of actions a worker can execute concurrently.
  *   `minCpuPlatform` (*type:* `String.t`, *default:* `nil`) - Minimum CPU platform to use when creating the worker. See [CPU Platforms](https://cloud.google.com/compute/docs/cpu-platforms).
  *   `networkAccess` (*type:* `String.t`, *default:* `nil`) - Determines the type of network access granted to workers. Possible values: - "public": Workers can connect to the public internet. - "private": Workers can only connect to Google APIs and services. - "restricted-private": Workers can only connect to Google APIs that are reachable through `restricted.googleapis.com` (`199.36.153.4/30`).
  *   `reserved` (*type:* `boolean()`, *default:* `nil`) - Determines whether the worker is reserved (equivalent to a Compute Engine on-demand VM and therefore won't be preempted). See [Preemptible VMs](https://cloud.google.com/preemptible-vms/) for more details.
  *   `soleTenantNodeType` (*type:* `String.t`, *default:* `nil`) - The node type name to be used for sole-tenant nodes.
  *   `vmImage` (*type:* `String.t`, *default:* `nil`) - The name of the image used by each VM.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accelerator =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaAcceleratorConfig.t()
            | nil,
          :diskSizeGb => String.t() | nil,
          :diskType => String.t() | nil,
          :labels => map() | nil,
          :machineType => String.t() | nil,
          :maxConcurrentActions => String.t() | nil,
          :minCpuPlatform => String.t() | nil,
          :networkAccess => String.t() | nil,
          :reserved => boolean() | nil,
          :soleTenantNodeType => String.t() | nil,
          :vmImage => String.t() | nil
        }

  field(:accelerator,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaAcceleratorConfig
  )

  field(:diskSizeGb)
  field(:diskType)
  field(:labels, type: :map)
  field(:machineType)
  field(:maxConcurrentActions)
  field(:minCpuPlatform)
  field(:networkAccess)
  field(:reserved)
  field(:soleTenantNodeType)
  field(:vmImage)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig do
  def decode(value, options) do
    GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaWorkerConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
