Class: Azure::ARM::Redis::Models::Sku

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/azure_mgmt_redis/models/sku.rb

Overview

Sku parameters supplied to the create redis operation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#capacityInteger

for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4)

Returns:

  • (Integer)

    What size of redis cache to deploy. Valid values:



26
27
28
# File 'lib/azure_mgmt_redis/models/sku.rb', line 26

def capacity
  @capacity
end

#familySkuFamily

Possible values include: ‘C’, ‘P’

Returns:

  • (SkuFamily)

    Which family to use. Valid values: (C, P).



22
23
24
# File 'lib/azure_mgmt_redis/models/sku.rb', line 22

def family
  @family
end

#nameSkuName

(Basic, Standard, Premium). Possible values include: ‘Basic’, ‘Standard’, ‘Premium’

Returns:

  • (SkuName)

    What type of redis cache to deploy. Valid values:



18
19
20
# File 'lib/azure_mgmt_redis/models/sku.rb', line 18

def name
  @name
end

Class Method Details

.deserialize_object(object) ⇒ Sku

Deserializes given Ruby Hash into Model object.

Parameters:

  • object (Hash)

    Ruby Hash object to deserialize.

Returns:

  • (Sku)

    Deserialized object.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/azure_mgmt_redis/models/sku.rb', line 63

def self.deserialize_object(object)
  return if object.nil?
  output_object = Sku.new

  deserialized_property = object['name']
  if (!deserialized_property.nil? && !deserialized_property.empty?)
    enum_is_valid = SkuName.constants.any? { |e| SkuName.const_get(e).to_s.downcase == deserialized_property.downcase }
    warn 'Enum SkuName does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
  end
  output_object.name = deserialized_property

  deserialized_property = object['family']
  if (!deserialized_property.nil? && !deserialized_property.empty?)
    enum_is_valid = SkuFamily.constants.any? { |e| SkuFamily.const_get(e).to_s.downcase == deserialized_property.downcase }
    warn 'Enum SkuFamily does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
  end
  output_object.family = deserialized_property

  deserialized_property = object['capacity']
  deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty?
  output_object.capacity = deserialized_property

  output_object
end

.serialize_object(object) ⇒ Hash

Serializes given Model object into Ruby Hash.

Parameters:

  • object

    Model object to serialize.

Returns:

  • (Hash)

    Serialized object in form of Ruby Hash.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/azure_mgmt_redis/models/sku.rb', line 42

def self.serialize_object(object)
  object.validate
  output_object = {}

  serialized_property = object.name
  output_object['name'] = serialized_property unless serialized_property.nil?

  serialized_property = object.family
  output_object['family'] = serialized_property unless serialized_property.nil?

  serialized_property = object.capacity
  output_object['capacity'] = serialized_property unless serialized_property.nil?

  output_object
end

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



31
32
33
34
35
# File 'lib/azure_mgmt_redis/models/sku.rb', line 31

def validate
  fail MsRest::ValidationError, 'property name is nil' if @name.nil?
  fail MsRest::ValidationError, 'property family is nil' if @family.nil?
  fail MsRest::ValidationError, 'property capacity is nil' if @capacity.nil?
end