# 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.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicy do
  @moduledoc """
  FeaturePolicy defines features allowed to be used on RBE instances, as well as instance-wide behavior changes that take effect without opt-in or opt-out at usage time.

  ## Attributes

  *   `containerImageSources` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Which container image sources are allowed. Currently only RBE-supported registry (gcr.io) is allowed. One can allow all repositories under a project or one specific repository only. E.g. container_image_sources { policy: RESTRICTED allowed_values: [ "gcr.io/project-foo", "gcr.io/project-bar/repo-baz", ] } will allow any repositories under "gcr.io/project-foo" plus the repository "gcr.io/project-bar/repo-baz". Default (UNSPECIFIED) is equivalent to any source is allowed.
  *   `dockerAddCapabilities` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerAddCapabilities can be used or what capabilities are allowed.
  *   `dockerChrootPath` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerChrootPath can be used.
  *   `dockerNetwork` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerNetwork can be used or what network modes are allowed. E.g. one may allow `off` value only via `allowed_values`.
  *   `dockerPrivileged` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerPrivileged can be used.
  *   `dockerRunAsRoot` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerRunAsRoot can be used.
  *   `dockerRuntime` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerRuntime is allowed to be set or what runtimes are allowed. Note linux_isolation takes precedence, and if set, docker_runtime values may be rejected if they are incompatible with the selected isolation.
  *   `dockerSiblingContainers` (*type:* `GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t`, *default:* `nil`) - Whether dockerSiblingContainers can be used.
  *   `linuxIsolation` (*type:* `String.t`, *default:* `nil`) - linux_isolation allows overriding the docker runtime used for containers started on Linux.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :containerImageSources =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerAddCapabilities =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerChrootPath =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerNetwork =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerPrivileged =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerRunAsRoot =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerRuntime =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :dockerSiblingContainers =>
            GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature.t()
            | nil,
          :linuxIsolation => String.t() | nil
        }

  field(:containerImageSources,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerAddCapabilities,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerChrootPath,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerNetwork,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerPrivileged,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerRunAsRoot,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerRuntime,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:dockerSiblingContainers,
    as:
      GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaFeaturePolicyFeature
  )

  field(:linuxIsolation)
end

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

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