Class: MistApi::NetworkInternetAccess

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/network_internet_access.rb

Overview

Whether this network has direct internet access

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(create_simple_service_policy = false, destination_nat = SKIP, enabled = SKIP, restricted = false, static_nat = SKIP) ⇒ NetworkInternetAccess

Returns a new instance of NetworkInternetAccess.



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/mist_api/models/network_internet_access.rb', line 69

def initialize(create_simple_service_policy = false, destination_nat = SKIP,
               enabled = SKIP, restricted = false, static_nat = SKIP)
  unless create_simple_service_policy == SKIP
    @create_simple_service_policy =
      create_simple_service_policy
  end
  @destination_nat = destination_nat unless destination_nat == SKIP
  @enabled = enabled unless enabled == SKIP
  @restricted = restricted unless restricted == SKIP
  @static_nat = static_nat unless static_nat == SKIP
end

Instance Attribute Details

#create_simple_service_policyTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/mist_api/models/network_internet_access.rb', line 14

def create_simple_service_policy
  @create_simple_service_policy
end

#destination_natHash[String, NetworkInternetAccessDestinationNatProperty]

Property key can be an External IP (i.e. “63.16.0.3”), an External IP:Port (i.e. “63.16.0.3:443”), an External Port (i.e. “:443”), an External CIDR (i.e. “63.16.0.0/30”), an External CIDR:Port (i.e. “63.16.0.0/30:443”) or a Variable (i.e. “{myvar}”). At least one of the ‘internal_ip` or `port` must be defined



22
23
24
# File 'lib/mist_api/models/network_internet_access.rb', line 22

def destination_nat
  @destination_nat
end

#enabledTrueClass | FalseClass

Property key can be an External IP (i.e. “63.16.0.3”), an External IP:Port (i.e. “63.16.0.3:443”), an External Port (i.e. “:443”), an External CIDR (i.e. “63.16.0.0/30”), an External CIDR:Port (i.e. “63.16.0.0/30:443”) or a Variable (i.e. “{myvar}”). At least one of the ‘internal_ip` or `port` must be defined

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/mist_api/models/network_internet_access.rb', line 30

def enabled
  @enabled
end

#restrictedTrueClass | FalseClass

By default, all access is allowed, to only allow certain traffic, make ‘restricted`=`true` and define service_policies

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/mist_api/models/network_internet_access.rb', line 35

def restricted
  @restricted
end

#static_natHash[String, NetworkInternetAccessStaticNatProperty]

Property key may be an External IP Address (i.e. “63.16.0.3”), a CIDR (i.e. “63.16.0.12/20”) or a Variable (i.e. “{myvar}”)

Returns:



40
41
42
# File 'lib/mist_api/models/network_internet_access.rb', line 40

def static_nat
  @static_nat
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/network_internet_access.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  create_simple_service_policy =
    hash['create_simple_service_policy'] ||= false
  if hash['destination_nat']
    destination_nat = NetworkInternetAccessDestinationNatProperty.from_hash(hash['destination_nat'])
  end

  destination_nat = SKIP unless hash.key?('destination_nat')
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  restricted = hash['restricted'] ||= false
  static_nat = NetworkInternetAccessStaticNatProperty.from_hash(hash['static_nat']) if
    hash['static_nat']

  static_nat = SKIP unless hash.key?('static_nat')

  # Create object from extracted values.
  NetworkInternetAccess.new(create_simple_service_policy,
                            destination_nat,
                            enabled,
                            restricted,
                            static_nat)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
# File 'lib/mist_api/models/network_internet_access.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['create_simple_service_policy'] = 'create_simple_service_policy'
  @_hash['destination_nat'] = 'destination_nat'
  @_hash['enabled'] = 'enabled'
  @_hash['restricted'] = 'restricted'
  @_hash['static_nat'] = 'static_nat'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/mist_api/models/network_internet_access.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/network_internet_access.rb', line 54

def self.optionals
  %w[
    create_simple_service_policy
    destination_nat
    enabled
    restricted
    static_nat
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



110
111
112
113
114
115
116
# File 'lib/mist_api/models/network_internet_access.rb', line 110

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
# File 'lib/mist_api/models/network_internet_access.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} create_simple_service_policy: #{@create_simple_service_policy.inspect},"\
  " destination_nat: #{@destination_nat.inspect}, enabled: #{@enabled.inspect}, restricted:"\
  " #{@restricted.inspect}, static_nat: #{@static_nat.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/mist_api/models/network_internet_access.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} create_simple_service_policy: #{@create_simple_service_policy},"\
  " destination_nat: #{@destination_nat}, enabled: #{@enabled}, restricted: #{@restricted},"\
  " static_nat: #{@static_nat}>"
end