# 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.CloudResourceManager.V1.Model.Constraint do
  @moduledoc """
  A `Constraint` describes a way in which a resource's configuration can be restricted. For example, it controls which cloud services can be activated across an organization, or whether a Compute Engine instance can have serial port connections established. `Constraints` can be configured by the organization's policy administrator to fit the needs of the organzation by setting Policies for `Constraints` at different locations in the organization's resource hierarchy. Policies are inherited down the resource hierarchy from higher levels, but can also be overridden. For details about the inheritance rules please read about [Policies](/resource-manager/reference/rest/v1/Policy). `Constraints` have a default behavior determined by the `constraint_default` field, which is the enforcement behavior that is used in the absence of a `Policy` being defined or inherited for the resource in question.

  ## Attributes

  *   `booleanConstraint` (*type:* `GoogleApi.CloudResourceManager.V1.Model.BooleanConstraint.t`, *default:* `nil`) - Defines this constraint as being a BooleanConstraint.
  *   `constraintDefault` (*type:* `String.t`, *default:* `nil`) - The evaluation behavior of this constraint in the absence of 'Policy'.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Detailed description of what this `Constraint` controls as well as how and where it is enforced. Mutable.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The human readable name. Mutable.
  *   `listConstraint` (*type:* `GoogleApi.CloudResourceManager.V1.Model.ListConstraint.t`, *default:* `nil`) - Defines this constraint as being a ListConstraint.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable value, required to globally be unique. For example, `constraints/serviceuser.services`
  *   `version` (*type:* `integer()`, *default:* `nil`) - Version of the `Constraint`. Default version is 0;
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :booleanConstraint =>
            GoogleApi.CloudResourceManager.V1.Model.BooleanConstraint.t() | nil,
          :constraintDefault => String.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :listConstraint => GoogleApi.CloudResourceManager.V1.Model.ListConstraint.t() | nil,
          :name => String.t() | nil,
          :version => integer() | nil
        }

  field(:booleanConstraint, as: GoogleApi.CloudResourceManager.V1.Model.BooleanConstraint)
  field(:constraintDefault)
  field(:description)
  field(:displayName)
  field(:listConstraint, as: GoogleApi.CloudResourceManager.V1.Model.ListConstraint)
  field(:name)
  field(:version)
end

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

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