# 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.SQLAdmin.V1.Model.Operation do
  @moduledoc """
  An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource.

  ## Attributes

  *   `acquireSsrsLeaseContext` (*type:* `GoogleApi.SQLAdmin.V1.Model.AcquireSsrsLeaseContext.t`, *default:* `nil`) - The context for acquire SSRS lease operation, if applicable.
  *   `apiWarning` (*type:* `GoogleApi.SQLAdmin.V1.Model.ApiWarning.t`, *default:* `nil`) - An Admin API warning message.
  *   `backupContext` (*type:* `GoogleApi.SQLAdmin.V1.Model.BackupContext.t`, *default:* `nil`) - The context for backup operation, if applicable.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - The time this operation finished in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
  *   `error` (*type:* `GoogleApi.SQLAdmin.V1.Model.OperationErrors.t`, *default:* `nil`) - If errors occurred during processing of this operation, this field will be populated.
  *   `exportContext` (*type:* `GoogleApi.SQLAdmin.V1.Model.ExportContext.t`, *default:* `nil`) - The context for export operation, if applicable.
  *   `importContext` (*type:* `GoogleApi.SQLAdmin.V1.Model.ImportContext.t`, *default:* `nil`) - The context for import operation, if applicable.
  *   `insertTime` (*type:* `DateTime.t`, *default:* `nil`) - The time this operation was enqueued in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - This is always `sql#operation`.
  *   `name` (*type:* `String.t`, *default:* `nil`) - An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation.
  *   `operationType` (*type:* `String.t`, *default:* `nil`) - The type of the operation. Valid values are: * `CREATE` * `DELETE` * `UPDATE` * `RESTART` * `IMPORT` * `EXPORT` * `BACKUP_VOLUME` * `RESTORE_VOLUME` * `CREATE_USER` * `DELETE_USER` * `CREATE_DATABASE` * `DELETE_DATABASE`
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - The URI of this resource.
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - The time this operation actually started in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
  *   `status` (*type:* `String.t`, *default:* `nil`) - The status of an operation.
  *   `subOperationType` (*type:* `GoogleApi.SQLAdmin.V1.Model.SqlSubOperationType.t`, *default:* `nil`) - Optional. The sub operation based on the operation type.
  *   `targetId` (*type:* `String.t`, *default:* `nil`) - Name of the resource on which this operation runs.
  *   `targetLink` (*type:* `String.t`, *default:* `nil`) - 
  *   `targetProject` (*type:* `String.t`, *default:* `nil`) - The project ID of the target instance related to this operation.
  *   `user` (*type:* `String.t`, *default:* `nil`) - The email address of the user who initiated this operation.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :acquireSsrsLeaseContext =>
            GoogleApi.SQLAdmin.V1.Model.AcquireSsrsLeaseContext.t() | nil,
          :apiWarning => GoogleApi.SQLAdmin.V1.Model.ApiWarning.t() | nil,
          :backupContext => GoogleApi.SQLAdmin.V1.Model.BackupContext.t() | nil,
          :endTime => DateTime.t() | nil,
          :error => GoogleApi.SQLAdmin.V1.Model.OperationErrors.t() | nil,
          :exportContext => GoogleApi.SQLAdmin.V1.Model.ExportContext.t() | nil,
          :importContext => GoogleApi.SQLAdmin.V1.Model.ImportContext.t() | nil,
          :insertTime => DateTime.t() | nil,
          :kind => String.t() | nil,
          :name => String.t() | nil,
          :operationType => String.t() | nil,
          :selfLink => String.t() | nil,
          :startTime => DateTime.t() | nil,
          :status => String.t() | nil,
          :subOperationType => GoogleApi.SQLAdmin.V1.Model.SqlSubOperationType.t() | nil,
          :targetId => String.t() | nil,
          :targetLink => String.t() | nil,
          :targetProject => String.t() | nil,
          :user => String.t() | nil
        }

  field(:acquireSsrsLeaseContext, as: GoogleApi.SQLAdmin.V1.Model.AcquireSsrsLeaseContext)
  field(:apiWarning, as: GoogleApi.SQLAdmin.V1.Model.ApiWarning)
  field(:backupContext, as: GoogleApi.SQLAdmin.V1.Model.BackupContext)
  field(:endTime, as: DateTime)
  field(:error, as: GoogleApi.SQLAdmin.V1.Model.OperationErrors)
  field(:exportContext, as: GoogleApi.SQLAdmin.V1.Model.ExportContext)
  field(:importContext, as: GoogleApi.SQLAdmin.V1.Model.ImportContext)
  field(:insertTime, as: DateTime)
  field(:kind)
  field(:name)
  field(:operationType)
  field(:selfLink)
  field(:startTime, as: DateTime)
  field(:status)
  field(:subOperationType, as: GoogleApi.SQLAdmin.V1.Model.SqlSubOperationType)
  field(:targetId)
  field(:targetLink)
  field(:targetProject)
  field(:user)
end

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

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