# 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.Eventarc.V1.Model.Enrollment do
  @moduledoc """
  An enrollment represents a subscription for messages on a particular message bus. It defines a matching criteria for messages on the bus and the subscriber endpoint where matched messages should be delivered.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - Optional. Resource annotations.
  *   `celMatch` (*type:* `String.t`, *default:* `nil`) - Required. A CEL expression identifying which messages this enrollment applies to.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The creation time.
  *   `destination` (*type:* `String.t`, *default:* `nil`) - Required. Destination is the Pipeline that the Enrollment is delivering to. It must point to the full resource name of a Pipeline. Format: "projects/{PROJECT_ID}/locations/{region}/pipelines/{PIPELINE_ID)"
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Optional. Resource display name.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on update and delete requests to ensure that the client has an up-to-date value before proceeding.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. Resource labels.
  *   `messageBus` (*type:* `String.t`, *default:* `nil`) - Required. Resource name of the message bus identifying the source of the messages. It matches the form projects/{project}/locations/{location}/messageBuses/{messageBus}.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Resource name of the form projects/{project}/locations/{location}/enrollments/{enrollment}
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Server assigned unique identifier for the channel. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last-modified time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :celMatch => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :destination => String.t() | nil,
          :displayName => String.t() | nil,
          :etag => String.t() | nil,
          :labels => map() | nil,
          :messageBus => String.t() | nil,
          :name => String.t() | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:annotations, type: :map)
  field(:celMatch)
  field(:createTime, as: DateTime)
  field(:destination)
  field(:displayName)
  field(:etag)
  field(:labels, type: :map)
  field(:messageBus)
  field(:name)
  field(:uid)
  field(:updateTime, as: DateTime)
end

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

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