# 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.IAP.V1.Model.PolicyDelegationSettings do
  @moduledoc """
  PolicyDelegationConfig allows google-internal teams to use IAP for apps hosted in a tenant project. Using these settings, the app can delegate permission check to happen against the linked customer project. This is only ever supposed to be used by google internal teams, hence the restriction on the proto.

  ## Attributes

  *   `iamPermission` (*type:* `String.t`, *default:* `nil`) - Permission to check in IAM.
  *   `iamServiceName` (*type:* `String.t`, *default:* `nil`) - The DNS name of the service (e.g. "resourcemanager.googleapis.com"). This should be the domain name part of the full resource names (see https://aip.dev/122#full-resource-names), which is usually the same as IamServiceSpec.service of the service where the resource type is defined.
  *   `policyName` (*type:* `GoogleApi.IAP.V1.Model.PolicyName.t`, *default:* `nil`) - Policy name to be checked
  *   `resource` (*type:* `GoogleApi.IAP.V1.Model.Resource.t`, *default:* `nil`) - IAM resource to check permission on
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :iamPermission => String.t() | nil,
          :iamServiceName => String.t() | nil,
          :policyName => GoogleApi.IAP.V1.Model.PolicyName.t() | nil,
          :resource => GoogleApi.IAP.V1.Model.Resource.t() | nil
        }

  field(:iamPermission)
  field(:iamServiceName)
  field(:policyName, as: GoogleApi.IAP.V1.Model.PolicyName)
  field(:resource, as: GoogleApi.IAP.V1.Model.Resource)
end

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

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