# 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.Pipeline do
  @moduledoc """
  A representation of the Pipeline resource.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - Optional. User-defined annotations. See https://google.aip.dev/128#annotations.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
  *   `cryptoKeyName` (*type:* `String.t`, *default:* `nil`) - Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt the event data. If not set, an internal Google-owned key will be used to encrypt messages. It must match the pattern "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}".
  *   `destinations` (*type:* `list(GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestination.t)`, *default:* `nil`) - Required. List of destinations to which messages will be forwarded. Currently, exactly one destination is supported per Pipeline.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Optional. Display name of resource.
  *   `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 create requests to ensure that the client has an up-to-date value before proceeding.
  *   `inputPayloadFormat` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMessagePayloadFormat.t`, *default:* `nil`) - Optional. The payload format expected for the messages received by the Pipeline. If input_payload_format is set then any messages not matching this format will be treated as persistent errors. If input_payload_format is not set, then the message data will be treated as an opaque binary and no output format can be set on the Pipeline through the Pipeline.Destination.output_payload_format field. Any Mediations on the Pipeline that involve access to the data field will fail as persistent errors.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. User labels attached to the Pipeline that can be used to group resources. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
  *   `loggingConfig` (*type:* `GoogleApi.Eventarc.V1.Model.LoggingConfig.t`, *default:* `nil`) - Optional. Config to control Platform Logging for Pipelines.
  *   `mediations` (*type:* `list(GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMediation.t)`, *default:* `nil`) - Optional. List of mediation operations to be performed on the message. Currently, only one Transformation operation is allowed in each Pipeline.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. The resource name of the Pipeline. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/pipelines/{pipeline}` format.
  *   `retryPolicy` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineRetryPolicy.t`, *default:* `nil`) - Optional. The retry policy to use in the pipeline.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Server-assigned unique identifier for the Pipeline. 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. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :createTime => DateTime.t() | nil,
          :cryptoKeyName => String.t() | nil,
          :destinations =>
            list(GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestination.t()) | nil,
          :displayName => String.t() | nil,
          :etag => String.t() | nil,
          :inputPayloadFormat =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMessagePayloadFormat.t()
            | nil,
          :labels => map() | nil,
          :loggingConfig => GoogleApi.Eventarc.V1.Model.LoggingConfig.t() | nil,
          :mediations =>
            list(GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMediation.t()) | nil,
          :name => String.t() | nil,
          :retryPolicy =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineRetryPolicy.t() | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:annotations, type: :map)
  field(:createTime, as: DateTime)
  field(:cryptoKeyName)

  field(:destinations,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestination,
    type: :list
  )

  field(:displayName)
  field(:etag)

  field(:inputPayloadFormat,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMessagePayloadFormat
  )

  field(:labels, type: :map)
  field(:loggingConfig, as: GoogleApi.Eventarc.V1.Model.LoggingConfig)

  field(:mediations,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMediation,
    type: :list
  )

  field(:name)
  field(:retryPolicy, as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineRetryPolicy)
  field(:uid)
  field(:updateTime, as: DateTime)
end

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

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