# 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.ServiceControl.V2.Model.Api do
  @moduledoc """
  This message defines attributes associated with API operations, such as a network API request. The terminology is based on the conventions used by Google APIs, Istio, and OpenAPI.

  ## Attributes

  *   `operation` (*type:* `String.t`, *default:* `nil`) - The API operation name. For gRPC requests, it is the fully qualified API method name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPI requests, it is the `operationId`, such as "getPet".
  *   `protocol` (*type:* `String.t`, *default:* `nil`) - The API protocol used for sending the request, such as "http", "https", "grpc", or "internal".
  *   `service` (*type:* `String.t`, *default:* `nil`) - The API service name. It is a logical identifier for a networked API, such as "pubsub.googleapis.com". The naming syntax depends on the API management system being used for handling the request.
  *   `version` (*type:* `String.t`, *default:* `nil`) - The API version associated with the API operation above, such as "v1" or "v1alpha1".
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :operation => String.t() | nil,
          :protocol => String.t() | nil,
          :service => String.t() | nil,
          :version => String.t() | nil
        }

  field(:operation)
  field(:protocol)
  field(:service)
  field(:version)
end

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

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