# 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.Connectors.V1.Model.RoleGrant do
  @moduledoc """
  This configuration defines all the Cloud IAM roles that needs to be granted to a particular Google Cloud resource for the selected principal like service account. These configurations will let UI display to customers what IAM roles need to be granted by them. Or these configurations can be used by the UI to render a 'grant' button to do the same on behalf of the user.

  ## Attributes

  *   `helperTextTemplate` (*type:* `String.t`, *default:* `nil`) - Optional. Template that UI can use to provide helper text to customers.
  *   `principal` (*type:* `String.t`, *default:* `nil`) - Optional. Principal/Identity for whom the role need to assigned.
  *   `resource` (*type:* `GoogleApi.Connectors.V1.Model.Resource.t`, *default:* `nil`) - Optional. Resource on which the roles needs to be granted for the principal.
  *   `roles` (*type:* `list(String.t)`, *default:* `nil`) - Optional. List of roles that need to be granted.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :helperTextTemplate => String.t() | nil,
          :principal => String.t() | nil,
          :resource => GoogleApi.Connectors.V1.Model.Resource.t() | nil,
          :roles => list(String.t()) | nil
        }

  field(:helperTextTemplate)
  field(:principal)
  field(:resource, as: GoogleApi.Connectors.V1.Model.Resource)
  field(:roles, type: :list)
end

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

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