# 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.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceMetadata do
  @moduledoc """
  Common model for database resource instance metadata. Next ID: 25

  ## Attributes

  *   `availabilityConfiguration` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainAvailabilityConfiguration.t`, *default:* `nil`) - Availability configuration for this instance
  *   `backupConfiguration` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration.t`, *default:* `nil`) - Backup configuration for this instance
  *   `backupRun` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun.t`, *default:* `nil`) - Latest backup run information for this instance
  *   `creationTime` (*type:* `DateTime.t`, *default:* `nil`) - The creation time of the resource, i.e. the time when resource is created and recorded in partner service.
  *   `currentState` (*type:* `String.t`, *default:* `nil`) - Current state of the instance.
  *   `customMetadata` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainCustomMetadataData.t`, *default:* `nil`) - Any custom metadata associated with the resource
  *   `edition` (*type:* `String.t`, *default:* `nil`) - Optional. Edition represents whether the instance is ENTERPRISE or ENTERPRISE_PLUS. This information is core to Cloud SQL only and is used to identify the edition of the instance.
  *   `entitlements` (*type:* `list(GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainEntitlement.t)`, *default:* `nil`) - Entitlements associated with the resource
  *   `expectedState` (*type:* `String.t`, *default:* `nil`) - The state that the instance is expected to be in. For example, an instance state can transition to UNHEALTHY due to wrong patch update, while the expected state will remain at the HEALTHY.
  *   `gcbdrConfiguration` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainGCBDRConfiguration.t`, *default:* `nil`) - GCBDR configuration for the resource.
  *   `id` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t`, *default:* `nil`) - Required. Unique identifier for a Database resource
  *   `instanceType` (*type:* `String.t`, *default:* `nil`) - The type of the instance. Specified at creation time.
  *   `location` (*type:* `String.t`, *default:* `nil`) - The resource location. REQUIRED
  *   `machineConfiguration` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainMachineConfiguration.t`, *default:* `nil`) - Machine configuration for this resource.
  *   `primaryResourceId` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t`, *default:* `nil`) - Identifier for this resource's immediate parent/primary resource if the current resource is a replica or derived form of another Database resource. Else it would be NULL. REQUIRED if the immediate parent exists when first time resource is getting ingested, otherwise optional.
  *   `primaryResourceLocation` (*type:* `String.t`, *default:* `nil`) - Primary resource location. REQUIRED if the immediate parent exists when first time resource is getting ingested, otherwise optional.
  *   `product` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct.t`, *default:* `nil`) - The product this resource represents.
  *   `resourceContainer` (*type:* `String.t`, *default:* `nil`) - Closest parent Cloud Resource Manager container of this resource. It must be resource name of a Cloud Resource Manager project with the format of "/", such as "projects/123". For GCP provided resources, number should be project number.
  *   `resourceName` (*type:* `String.t`, *default:* `nil`) - Required. Different from DatabaseResourceId.unique_id, a resource name can be reused over time. That is, after a resource named "ABC" is deleted, the name "ABC" can be used to to create a new resource within the same source. Resource name to follow CAIS resource_name format as noted here go/condor-common-datamodel
  *   `suspensionReason` (*type:* `String.t`, *default:* `nil`) - Optional. Suspension reason for the resource.
  *   `tagsSet` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainTags.t`, *default:* `nil`) - Optional. Tags associated with this resources.
  *   `updationTime` (*type:* `DateTime.t`, *default:* `nil`) - The time at which the resource was updated and recorded at partner service.
  *   `userLabelSet` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainUserLabels.t`, *default:* `nil`) - User-provided labels associated with the resource
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :availabilityConfiguration =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainAvailabilityConfiguration.t()
            | nil,
          :backupConfiguration =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration.t()
            | nil,
          :backupRun =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun.t() | nil,
          :creationTime => DateTime.t() | nil,
          :currentState => String.t() | nil,
          :customMetadata =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainCustomMetadataData.t()
            | nil,
          :edition => String.t() | nil,
          :entitlements =>
            list(GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainEntitlement.t())
            | nil,
          :expectedState => String.t() | nil,
          :gcbdrConfiguration =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainGCBDRConfiguration.t()
            | nil,
          :id =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t()
            | nil,
          :instanceType => String.t() | nil,
          :location => String.t() | nil,
          :machineConfiguration =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainMachineConfiguration.t()
            | nil,
          :primaryResourceId =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t()
            | nil,
          :primaryResourceLocation => String.t() | nil,
          :product =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct.t() | nil,
          :resourceContainer => String.t() | nil,
          :resourceName => String.t() | nil,
          :suspensionReason => String.t() | nil,
          :tagsSet =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainTags.t() | nil,
          :updationTime => DateTime.t() | nil,
          :userLabelSet =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainUserLabels.t() | nil
        }

  field(:availabilityConfiguration,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainAvailabilityConfiguration
  )

  field(:backupConfiguration,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration
  )

  field(:backupRun, as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun)
  field(:creationTime, as: DateTime)
  field(:currentState)

  field(:customMetadata,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainCustomMetadataData
  )

  field(:edition)

  field(:entitlements,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainEntitlement,
    type: :list
  )

  field(:expectedState)

  field(:gcbdrConfiguration,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainGCBDRConfiguration
  )

  field(:id,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId
  )

  field(:instanceType)
  field(:location)

  field(:machineConfiguration,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainMachineConfiguration
  )

  field(:primaryResourceId,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId
  )

  field(:primaryResourceLocation)
  field(:product, as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct)
  field(:resourceContainer)
  field(:resourceName)
  field(:suspensionReason)
  field(:tagsSet, as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainTags)
  field(:updationTime, as: DateTime)

  field(:userLabelSet,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainUserLabels
  )
end

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

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