# 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.GoogleCloudEventarcV1PipelineDestination do
  @moduledoc """
  Represents a target of an invocation over HTTP.

  ## Attributes

  *   `authenticationConfig` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig.t`, *default:* `nil`) - Optional. An authentication config used to authenticate message requests, such that destinations can verify the source. For example, this can be used with private GCP destinations that require GCP credentials to access like Cloud Run. This field is optional and should be set only by users interested in authenticated push
  *   `httpEndpoint` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationHttpEndpoint.t`, *default:* `nil`) - Optional. An HTTP endpoint destination described by an URI. If a DNS FQDN is provided as the endpoint, Pipeline will create a peering zone to the consumer VPC and forward DNS requests to the VPC specified by network config to resolve the service endpoint. See: https://cloud.google.com/dns/docs/zones/zones-overview#peering_zones
  *   `messageBus` (*type:* `String.t`, *default:* `nil`) - Optional. The resource name of the Message Bus to which events should be published. The Message Bus resource should exist in the same project as the Pipeline. Format: `projects/{project}/locations/{location}/messageBuses/{message_bus}`
  *   `networkConfig` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationNetworkConfig.t`, *default:* `nil`) - Optional. Network config is used to configure how Pipeline resolves and connects to a destination.
  *   `outputPayloadFormat` (*type:* `GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMessagePayloadFormat.t`, *default:* `nil`) - Optional. The message format before it is delivered to the destination. If not set, the message will be delivered in the format it was originally delivered to the Pipeline. This field can only be set if Pipeline.input_payload_format is also set.
  *   `topic` (*type:* `String.t`, *default:* `nil`) - Optional. The resource name of the Pub/Sub topic to which events should be published. Format: `projects/{project}/locations/{location}/topics/{topic}`
  *   `workflow` (*type:* `String.t`, *default:* `nil`) - Optional. The resource name of the Workflow whose Executions are triggered by the events. The Workflow resource should be deployed in the same project as the Pipeline. Format: `projects/{project}/locations/{location}/workflows/{workflow}`
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :authenticationConfig =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig.t()
            | nil,
          :httpEndpoint =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationHttpEndpoint.t()
            | nil,
          :messageBus => String.t() | nil,
          :networkConfig =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationNetworkConfig.t()
            | nil,
          :outputPayloadFormat =>
            GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineMessagePayloadFormat.t()
            | nil,
          :topic => String.t() | nil,
          :workflow => String.t() | nil
        }

  field(:authenticationConfig,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig
  )

  field(:httpEndpoint,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationHttpEndpoint
  )

  field(:messageBus)

  field(:networkConfig,
    as: GoogleApi.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineDestinationNetworkConfig
  )

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

  field(:topic)
  field(:workflow)
end

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

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