# 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.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2Policy do
  @moduledoc """
  Defines an organization policy which is used to specify constraints for configurations of Google Cloud resources.

  ## Attributes

  *   `alternate` (*type:* `GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2AlternatePolicySpec.t`, *default:* `nil`) - Deprecated.
  *   `dryRunSpec` (*type:* `GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec.t`, *default:* `nil`) - Dry-run policy. Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This 'etag' is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. The resource name of the policy. Must be one of the following forms, where `constraint_name` is the name of the constraint which this policy configures: * `projects/{project_number}/policies/{constraint_name}` * `folders/{folder_id}/policies/{constraint_name}` * `organizations/{organization_id}/policies/{constraint_name}` For example, `projects/123/policies/compute.disableSerialPortAccess`. Note: `projects/{project_id}/policies/{constraint_name}` is also an acceptable name for API requests, but responses will return the name using the equivalent project number.
  *   `spec` (*type:* `GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec.t`, *default:* `nil`) - Basic information about the organization policy.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :alternate =>
            GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2AlternatePolicySpec.t() | nil,
          :dryRunSpec => GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec.t() | nil,
          :etag => String.t() | nil,
          :name => String.t() | nil,
          :spec => GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec.t() | nil
        }

  field(:alternate, as: GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2AlternatePolicySpec)
  field(:dryRunSpec, as: GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec)
  field(:etag)
  field(:name)
  field(:spec, as: GoogleApi.OrgPolicy.V2.Model.GoogleCloudOrgpolicyV2PolicySpec)
end

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

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