# 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.Admin.Directory_v1.Model.RoleAssignment do
  @moduledoc """
  Defines an assignment of a role.

  ## Attributes

  *   `assignedTo` (*type:* `String.t`, *default:* `nil`) - The unique ID of the entity this role is assigned to—either the `user_id` of a user, the `group_id` of a group, or the `uniqueId` of a service account as defined in [Identity and Access Management (IAM)](https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAccounts).
  *   `assigneeType` (*type:* `String.t`, *default:* `nil`) - Output only. The type of the assignee (`USER` or `GROUP`).
  *   `etag` (*type:* `String.t`, *default:* `nil`) - ETag of the resource.
  *   `kind` (*type:* `String.t`, *default:* `admin#directory#roleAssignment`) - The type of the API resource. This is always `admin#directory#roleAssignment`.
  *   `orgUnitId` (*type:* `String.t`, *default:* `nil`) - If the role is restricted to an organization unit, this contains the ID for the organization unit the exercise of this role is restricted to.
  *   `roleAssignmentId` (*type:* `String.t`, *default:* `nil`) - ID of this roleAssignment.
  *   `roleId` (*type:* `String.t`, *default:* `nil`) - The ID of the role that is assigned.
  *   `scopeType` (*type:* `String.t`, *default:* `nil`) - The scope in which this role is assigned.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :assignedTo => String.t() | nil,
          :assigneeType => String.t() | nil,
          :etag => String.t() | nil,
          :kind => String.t() | nil,
          :orgUnitId => String.t() | nil,
          :roleAssignmentId => String.t() | nil,
          :roleId => String.t() | nil,
          :scopeType => String.t() | nil
        }

  field(:assignedTo)
  field(:assigneeType)
  field(:etag)
  field(:kind)
  field(:orgUnitId)
  field(:roleAssignmentId)
  field(:roleId)
  field(:scopeType)
end

defimpl Poison.Decoder, for: GoogleApi.Admin.Directory_v1.Model.RoleAssignment do
  def decode(value, options) do
    GoogleApi.Admin.Directory_v1.Model.RoleAssignment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Admin.Directory_v1.Model.RoleAssignment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
