lib/fastly/models/snippet.rb in fastly-7.1.1 vs lib/fastly/models/snippet.rb in fastly-7.2.0
- old
+ new
@@ -14,22 +14,22 @@
module Fastly
class Snippet
# The name for the snippet.
attr_accessor :name
- # Sets the snippet version.
- attr_accessor :dynamic
-
# The location in generated VCL where the snippet should be placed.
attr_accessor :type
# The VCL code that specifies exactly what the snippet does.
attr_accessor :content
# Priority determines execution order. Lower numbers execute first.
attr_accessor :priority
+ # Sets the snippet version.
+ attr_accessor :dynamic
+
class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
def initialize(datatype, allowable_values)
@@ -52,14 +52,14 @@
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'name' => :'name',
- :'dynamic' => :'dynamic',
:'type' => :'type',
:'content' => :'content',
- :'priority' => :'priority'
+ :'priority' => :'priority',
+ :'dynamic' => :'dynamic'
}
end
# Returns all the JSON keys this model knows about
def self.acceptable_attributes
@@ -68,23 +68,31 @@
# Attribute type mapping.
def self.fastly_types
{
:'name' => :'String',
- :'dynamic' => :'String',
:'type' => :'String',
:'content' => :'String',
- :'priority' => :'String'
+ :'priority' => :'String',
+ :'dynamic' => :'String'
}
end
# List of attributes with nullable: true
def self.fastly_nullable
Set.new([
])
end
+ # List of class defined in allOf (OpenAPI v3)
+ def self.fastly_all_of
+ [
+ :'SnippetAllOf',
+ :'SnippetCommon'
+ ]
+ end
+
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Snippet` initialize method"
@@ -100,14 +108,10 @@
if attributes.key?(:'name')
self.name = attributes[:'name']
end
- if attributes.key?(:'dynamic')
- self.dynamic = attributes[:'dynamic']
- end
-
if attributes.key?(:'type')
self.type = attributes[:'type']
end
if attributes.key?(:'content')
@@ -117,10 +121,14 @@
if attributes.key?(:'priority')
self.priority = attributes[:'priority']
else
self.priority = '100'
end
+
+ if attributes.key?(:'dynamic')
+ self.dynamic = attributes[:'dynamic']
+ end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
@@ -129,47 +137,47 @@
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
- dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
- return false unless dynamic_validator.valid?(@dynamic)
type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
return false unless type_validator.valid?(@type)
+ dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
+ return false unless dynamic_validator.valid?(@dynamic)
true
end
# Custom attribute writer method checking allowed values (enum).
- # @param [Object] dynamic Object to be assigned
- def dynamic=(dynamic)
- validator = EnumAttributeValidator.new('String', ["0", "1"])
- unless validator.valid?(dynamic)
- fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
- end
- @dynamic = dynamic
- end
-
- # Custom attribute writer method checking allowed values (enum).
# @param [Object] type Object to be assigned
def type=(type)
validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
unless validator.valid?(type)
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
end
@type = type
end
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] dynamic Object to be assigned
+ def dynamic=(dynamic)
+ validator = EnumAttributeValidator.new('String', ["0", "1"])
+ unless validator.valid?(dynamic)
+ fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
+ end
+ @dynamic = dynamic
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
name == o.name &&
- dynamic == o.dynamic &&
type == o.type &&
content == o.content &&
- priority == o.priority
+ priority == o.priority &&
+ dynamic == o.dynamic
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
@@ -177,10 +185,10 @@
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [name, dynamic, type, content, priority].hash
+ [name, type, content, priority, dynamic].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself