lib/google_api/compute/v1/model/bulk_insert_instance_resource.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.BulkInsertInstanceResource do
  @moduledoc """
  A transient resource used in compute.instances.bulkInsert and compute.regionInstances.bulkInsert . This resource is not persisted anywhere, it is used only for processing the requests.

  ## Attributes

  *   `count` (*type:* `String.t`, *default:* `nil`) - The maximum number of instances to create.
  *   `instanceProperties` (*type:* `GoogleApi.Compute.V1.Model.InstanceProperties.t`, *default:* `nil`) - The instance properties defining the VM instances to be created. Required if sourceInstanceTemplate is not provided.
  *   `locationPolicy` (*type:* `GoogleApi.Compute.V1.Model.LocationPolicy.t`, *default:* `nil`) - Policy for chosing target zone.
  *   `minCount` (*type:* `String.t`, *default:* `nil`) - The minimum number of instances to create. If no min_count is specified then count is used as the default value. If min_count instances cannot be created, then no instances will be created and instances already created will be deleted.
  *   `namePattern` (*type:* `String.t`, *default:* `nil`) - The string pattern used for the names of the VMs. Either name_pattern or per_instance_properties must be set. The pattern must contain one continuous sequence of placeholder hash characters (#) with each character corresponding to one digit of the generated instance name. Example: a name_pattern of inst-#### generates instance names such as inst-0001 and inst-0002. If existing instances in the same project and zone have names that match the name pattern then the generated instance numbers start after the biggest existing number. For example, if there exists an instance with name inst-0050, then instance names generated using the pattern inst-#### begin with inst-0051. The name pattern placeholder #...# can contain up to 18 characters.
  *   `perInstanceProperties` (*type:* `%{optional(String.t) => GoogleApi.Compute.V1.Model.BulkInsertInstanceResourcePerInstanceProperties.t}`, *default:* `nil`) - Per-instance properties to be set on individual instances. Keys of this map specify requested instance names. Can be empty if name_pattern is used.
  *   `sourceInstanceTemplate` (*type:* `String.t`, *default:* `nil`) - Specifies the instance template from which to create instances. You may combine sourceInstanceTemplate with instanceProperties to override specific values from an existing instance template. Bulk API follows the semantics of JSON Merge Patch described by RFC 7396. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate This field is optional.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :count => String.t() | nil,
          :instanceProperties => GoogleApi.Compute.V1.Model.InstanceProperties.t() | nil,
          :locationPolicy => GoogleApi.Compute.V1.Model.LocationPolicy.t() | nil,
          :minCount => String.t() | nil,
          :namePattern => String.t() | nil,
          :perInstanceProperties =>
            %{
              optional(String.t()) =>
                GoogleApi.Compute.V1.Model.BulkInsertInstanceResourcePerInstanceProperties.t()
            }
            | nil,
          :sourceInstanceTemplate => String.t() | nil
        }

  field(:count)
  field(:instanceProperties, as: GoogleApi.Compute.V1.Model.InstanceProperties)
  field(:locationPolicy, as: GoogleApi.Compute.V1.Model.LocationPolicy)
  field(:minCount)
  field(:namePattern)

  field(:perInstanceProperties,
    as: GoogleApi.Compute.V1.Model.BulkInsertInstanceResourcePerInstanceProperties,
    type: :map
  )

  field(:sourceInstanceTemplate)
end

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

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