lib/google_api/compute/v1/model/cors_policy.ex

# 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.Compute.V1.Model.CorsPolicy do
  @moduledoc """
  The specification for allowing client side cross-origin requests. Please see W3C Recommendation for Cross Origin Resource Sharing

  ## Attributes

  *   `allowCredentials` (*type:* `boolean()`, *default:* `nil`) - In response to a preflight request, setting this to true indicates that the actual request can include user credentials. This translates to the Access-Control-Allow-Credentials header. Default is false.
  *   `allowHeaders` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for the Access-Control-Allow-Headers header.
  *   `allowMethods` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for the Access-Control-Allow-Methods header.
  *   `allowOriginRegexes` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the regualar expression patterns that match allowed origins. For regular expression grammar please see github.com/google/re2/wiki/Syntax An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes.
  *   `allowOrigins` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the list of origins that will be allowed to do CORS requests. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes.
  *   `disabled` (*type:* `boolean()`, *default:* `nil`) - If true, specifies the CORS policy is disabled. The default value of false, which indicates that the CORS policy is in effect.
  *   `exposeHeaders` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the content for the Access-Control-Expose-Headers header.
  *   `maxAge` (*type:* `integer()`, *default:* `nil`) - Specifies how long results of a preflight request can be cached in seconds. This translates to the Access-Control-Max-Age header.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowCredentials => boolean() | nil,
          :allowHeaders => list(String.t()) | nil,
          :allowMethods => list(String.t()) | nil,
          :allowOriginRegexes => list(String.t()) | nil,
          :allowOrigins => list(String.t()) | nil,
          :disabled => boolean() | nil,
          :exposeHeaders => list(String.t()) | nil,
          :maxAge => integer() | nil
        }

  field(:allowCredentials)
  field(:allowHeaders, type: :list)
  field(:allowMethods, type: :list)
  field(:allowOriginRegexes, type: :list)
  field(:allowOrigins, type: :list)
  field(:disabled)
  field(:exposeHeaders, type: :list)
  field(:maxAge)
end

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

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