# 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.CloudFunctions.V2.Model.UpgradeInfo do
  @moduledoc """
  Information related to: * A function's eligibility for 1st Gen to 2nd Gen migration and 2nd Gen to CRf detach. * Current state of migration for function undergoing migration/detach.

  ## Attributes

  *   `buildConfig` (*type:* `GoogleApi.CloudFunctions.V2.Model.BuildConfig.t`, *default:* `nil`) - Describes the Build step of the function that builds a container to prepare for 2nd gen upgrade.
  *   `eventTrigger` (*type:* `GoogleApi.CloudFunctions.V2.Model.EventTrigger.t`, *default:* `nil`) - Describes the Event trigger which has been setup to prepare for 2nd gen upgrade.
  *   `serviceConfig` (*type:* `GoogleApi.CloudFunctions.V2.Model.ServiceConfig.t`, *default:* `nil`) - Describes the Cloud Run service which has been setup to prepare for 2nd gen upgrade.
  *   `upgradeState` (*type:* `String.t`, *default:* `nil`) - UpgradeState of the function
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :buildConfig => GoogleApi.CloudFunctions.V2.Model.BuildConfig.t() | nil,
          :eventTrigger => GoogleApi.CloudFunctions.V2.Model.EventTrigger.t() | nil,
          :serviceConfig => GoogleApi.CloudFunctions.V2.Model.ServiceConfig.t() | nil,
          :upgradeState => String.t() | nil
        }

  field(:buildConfig, as: GoogleApi.CloudFunctions.V2.Model.BuildConfig)
  field(:eventTrigger, as: GoogleApi.CloudFunctions.V2.Model.EventTrigger)
  field(:serviceConfig, as: GoogleApi.CloudFunctions.V2.Model.ServiceConfig)
  field(:upgradeState)
end

defimpl Poison.Decoder, for: GoogleApi.CloudFunctions.V2.Model.UpgradeInfo do
  def decode(value, options) do
    GoogleApi.CloudFunctions.V2.Model.UpgradeInfo.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudFunctions.V2.Model.UpgradeInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
