Class: Fog::OpenStack::Network::Real

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/fog/openstack/network.rb,
lib/fog/openstack/network/requests/get_port.rb,
lib/fog/openstack/network/requests/get_quota.rb,
lib/fog/openstack/network/requests/get_lb_vip.rb,
lib/fog/openstack/network/requests/get_quotas.rb,
lib/fog/openstack/network/requests/get_router.rb,
lib/fog/openstack/network/requests/get_subnet.rb,
lib/fog/openstack/network/requests/list_ports.rb,
lib/fog/openstack/network/requests/set_tenant.rb,
lib/fog/openstack/network/requests/create_port.rb,
lib/fog/openstack/network/requests/delete_port.rb,
lib/fog/openstack/network/requests/get_lb_pool.rb,
lib/fog/openstack/network/requests/get_network.rb,
lib/fog/openstack/network/requests/update_port.rb,
lib/fog/openstack/network/requests/delete_quota.rb,
lib/fog/openstack/network/requests/list_lb_vips.rb,
lib/fog/openstack/network/requests/list_routers.rb,
lib/fog/openstack/network/requests/list_subnets.rb,
lib/fog/openstack/network/requests/update_quota.rb,
lib/fog/openstack/network/requests/create_lb_vip.rb,
lib/fog/openstack/network/requests/create_router.rb,
lib/fog/openstack/network/requests/create_subnet.rb,
lib/fog/openstack/network/requests/delete_lb_vip.rb,
lib/fog/openstack/network/requests/delete_router.rb,
lib/fog/openstack/network/requests/delete_subnet.rb,
lib/fog/openstack/network/requests/get_extension.rb,
lib/fog/openstack/network/requests/get_lb_member.rb,
lib/fog/openstack/network/requests/list_lb_pools.rb,
lib/fog/openstack/network/requests/list_networks.rb,
lib/fog/openstack/network/requests/update_lb_vip.rb,
lib/fog/openstack/network/requests/update_router.rb,
lib/fog/openstack/network/requests/update_subnet.rb,
lib/fog/openstack/network/requests/create_lb_pool.rb,
lib/fog/openstack/network/requests/create_network.rb,
lib/fog/openstack/network/requests/delete_lb_pool.rb,
lib/fog/openstack/network/requests/delete_network.rb,
lib/fog/openstack/network/requests/get_ike_policy.rb,
lib/fog/openstack/network/requests/get_lbaas_pool.rb,
lib/fog/openstack/network/requests/update_lb_pool.rb,
lib/fog/openstack/network/requests/update_network.rb,
lib/fog/openstack/network/requests/get_floating_ip.rb,
lib/fog/openstack/network/requests/get_rbac_policy.rb,
lib/fog/openstack/network/requests/get_subnet_pool.rb,
lib/fog/openstack/network/requests/get_vpn_service.rb,
lib/fog/openstack/network/requests/list_extensions.rb,
lib/fog/openstack/network/requests/list_lb_members.rb,
lib/fog/openstack/network/requests/create_lb_member.rb,
lib/fog/openstack/network/requests/delete_lb_member.rb,
lib/fog/openstack/network/requests/get_ipsec_policy.rb,
lib/fog/openstack/network/requests/get_lbaas_l7rule.rb,
lib/fog/openstack/network/requests/list_lbaas_pools.rb,
lib/fog/openstack/network/requests/update_lb_member.rb,
lib/fog/openstack/network/requests/create_ike_policy.rb,
lib/fog/openstack/network/requests/create_lbaas_pool.rb,
lib/fog/openstack/network/requests/delete_ike_policy.rb,
lib/fog/openstack/network/requests/delete_lbaas_pool.rb,
lib/fog/openstack/network/requests/get_lb_pool_stats.rb,
lib/fog/openstack/network/requests/list_floating_ips.rb,
lib/fog/openstack/network/requests/list_ike_policies.rb,
lib/fog/openstack/network/requests/list_subnet_pools.rb,
lib/fog/openstack/network/requests/list_vpn_services.rb,
lib/fog/openstack/network/requests/update_ike_policy.rb,
lib/fog/openstack/network/requests/update_lbaas_pool.rb,
lib/fog/openstack/network/requests/create_floating_ip.rb,
lib/fog/openstack/network/requests/create_rbac_policy.rb,
lib/fog/openstack/network/requests/create_subnet_pool.rb,
lib/fog/openstack/network/requests/create_vpn_service.rb,
lib/fog/openstack/network/requests/delete_floating_ip.rb,
lib/fog/openstack/network/requests/delete_rbac_policy.rb,
lib/fog/openstack/network/requests/delete_subnet_pool.rb,
lib/fog/openstack/network/requests/delete_vpn_service.rb,
lib/fog/openstack/network/requests/get_lbaas_l7policy.rb,
lib/fog/openstack/network/requests/get_lbaas_listener.rb,
lib/fog/openstack/network/requests/get_security_group.rb,
lib/fog/openstack/network/requests/list_lbaas_l7rules.rb,
lib/fog/openstack/network/requests/list_rbac_policies.rb,
lib/fog/openstack/network/requests/update_rbac_policy.rb,
lib/fog/openstack/network/requests/update_subnet_pool.rb,
lib/fog/openstack/network/requests/update_vpn_service.rb,
lib/fog/openstack/network/requests/create_ipsec_policy.rb,
lib/fog/openstack/network/requests/create_lbaas_l7rule.rb,
lib/fog/openstack/network/requests/delete_ipsec_policy.rb,
lib/fog/openstack/network/requests/delete_lbaas_l7rule.rb,
lib/fog/openstack/network/requests/list_ipsec_policies.rb,
lib/fog/openstack/network/requests/update_ipsec_policy.rb,
lib/fog/openstack/network/requests/update_lbaas_l7rule.rb,
lib/fog/openstack/network/requests/add_router_interface.rb,
lib/fog/openstack/network/requests/list_lbaas_listeners.rb,
lib/fog/openstack/network/requests/list_security_groups.rb,
lib/fog/openstack/network/requests/associate_floating_ip.rb,
lib/fog/openstack/network/requests/create_lbaas_l7policy.rb,
lib/fog/openstack/network/requests/create_lbaas_listener.rb,
lib/fog/openstack/network/requests/create_security_group.rb,
lib/fog/openstack/network/requests/delete_lbaas_l7policy.rb,
lib/fog/openstack/network/requests/delete_lbaas_listener.rb,
lib/fog/openstack/network/requests/delete_security_group.rb,
lib/fog/openstack/network/requests/get_lb_health_monitor.rb,
lib/fog/openstack/network/requests/get_lbaas_pool_member.rb,
lib/fog/openstack/network/requests/list_lbaas_l7policies.rb,
lib/fog/openstack/network/requests/update_lbaas_l7policy.rb,
lib/fog/openstack/network/requests/update_lbaas_listener.rb,
lib/fog/openstack/network/requests/update_security_group.rb,
lib/fog/openstack/network/requests/get_lbaas_loadbalancer.rb,
lib/fog/openstack/network/requests/get_lbaas_healthmonitor.rb,
lib/fog/openstack/network/requests/get_security_group_rule.rb,
lib/fog/openstack/network/requests/list_lb_health_monitors.rb,
lib/fog/openstack/network/requests/list_lbaas_pool_members.rb,
lib/fog/openstack/network/requests/remove_router_interface.rb,
lib/fog/openstack/network/requests/create_lb_health_monitor.rb,
lib/fog/openstack/network/requests/create_lbaas_pool_member.rb,
lib/fog/openstack/network/requests/delete_lb_health_monitor.rb,
lib/fog/openstack/network/requests/delete_lbaas_pool_member.rb,
lib/fog/openstack/network/requests/disassociate_floating_ip.rb,
lib/fog/openstack/network/requests/list_lbaas_loadbalancers.rb,
lib/fog/openstack/network/requests/update_lb_health_monitor.rb,
lib/fog/openstack/network/requests/update_lbaas_pool_member.rb,
lib/fog/openstack/network/requests/create_lbaas_loadbalancer.rb,
lib/fog/openstack/network/requests/delete_lbaas_loadbalancer.rb,
lib/fog/openstack/network/requests/get_ipsec_site_connection.rb,
lib/fog/openstack/network/requests/list_lbaas_healthmonitors.rb,
lib/fog/openstack/network/requests/list_security_group_rules.rb,
lib/fog/openstack/network/requests/update_lbaas_loadbalancer.rb,
lib/fog/openstack/network/requests/create_lbaas_healthmonitor.rb,
lib/fog/openstack/network/requests/create_security_group_rule.rb,
lib/fog/openstack/network/requests/delete_lbaas_healthmonitor.rb,
lib/fog/openstack/network/requests/delete_security_group_rule.rb,
lib/fog/openstack/network/requests/update_lbaas_healthmonitor.rb,
lib/fog/openstack/network/requests/associate_lb_health_monitor.rb,
lib/fog/openstack/network/requests/get_network_ip_availability.rb,
lib/fog/openstack/network/requests/list_ipsec_site_connections.rb,
lib/fog/openstack/network/requests/create_ipsec_site_connection.rb,
lib/fog/openstack/network/requests/delete_ipsec_site_connection.rb,
lib/fog/openstack/network/requests/update_ipsec_site_connection.rb,
lib/fog/openstack/network/requests/disassociate_lb_health_monitor.rb,
lib/fog/openstack/network/requests/list_network_ip_availabilities.rb

Constant Summary collapse

CREATE_OPTIONS =
[
  :name,
  :shared,
  :admin_state_up,
  :qos_policy_id,
  :port_security_enabled,
  :tenant_id,
].freeze
EXTENTED_OPTIONS =

Advanced Features through API Extensions

Not strictly required but commonly found in OpenStack installs with Quantum networking.

[
  :provider_network_type,
  :provider_segmentation_id,
  :provider_physical_network,
  :router_external,
].freeze
ALIASES =

Map Fog::OpenStack::Network::Network model attributes to OpenStack provider attributes

{
  :provider_network_type     => 'provider:network_type',

  # Not applicable to the "local" or "gre" network types
  :provider_physical_network => 'provider:physical_network',
  :provider_segmentation_id  => 'provider:segmentation_id',

  :router_external           => 'router:external'
}.freeze
UPDATE_OPTIONS =

Not all options can be updated

[
  :name,
  :shared,
  :admin_state_up,
  :qos_policy_id,
  :port_security_enabled
].freeze
UPDATE_EXTENTED_OPTIONS =

Not all extra options can be updated

[
  :router_external
].freeze

Instance Attribute Summary

Attributes included from Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_api_version, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core

#credentials, #initialize, #reload

Class Method Details

.create(options) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/openstack/network/requests/create_network.rb', line 40

def self.create(options)
  data = {}
  CREATE_OPTIONS.reject { |o| options[o].nil? }.each do |key|
    data[key.to_s] = options[key]
  end

  EXTENTED_OPTIONS.reject { |o| options[o].nil? }.each do |key|
    aliased_key = ALIASES[key] || key
    data[aliased_key] = options[key]
  end
  data
end

.not_found_classObject



444
445
446
# File 'lib/fog/openstack/network.rb', line 444

def self.not_found_class
  Fog::OpenStack::Network::NotFound
end

.update(options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/openstack/network/requests/update_network.rb', line 19

def self.update(options)
  data = {}
  UPDATE_OPTIONS.select { |o| options.key?(o) }.each do |key|
    data[key.to_s] = options[key]
  end

  UPDATE_EXTENTED_OPTIONS.reject { |o| options[o].nil? }.each do |key|
    aliased_key = ALIASES[key] || key
    data[aliased_key] = options[key]
  end
  data
end

Instance Method Details

#add_router_interface(router_id, subnet_id_or_options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/openstack/network/requests/add_router_interface.rb', line 5

def add_router_interface(router_id, subnet_id_or_options)
  if subnet_id_or_options.kind_of? String
    data = {
      'subnet_id' => subnet_id_or_options,
    }
  elsif subnet_id_or_options.kind_of? Hash
    data = subnet_id_or_options
  else
    raise ArgumentError, 'Please pass a subnet id or hash {subnet_id:xxx,port_id:xxx}'
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "routers/#{router_id}/add_router_interface"
  )
end

#associate_floating_ip(floating_ip_id, port_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/openstack/network/requests/associate_floating_ip.rb', line 5

def associate_floating_ip(floating_ip_id, port_id, options = {})
  data = {
    'floatingip' => {
      'port_id' => port_id,
    }
  }

  vanilla_options = [:fixed_ip_address]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['floatingip'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "floatingips/#{floating_ip_id}"
  )
end

#associate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/openstack/network/requests/associate_lb_health_monitor.rb', line 5

def associate_lb_health_monitor(pool_id, health_monitor_id)
  data = {
    'health_monitor' => {
      'id' => health_monitor_id,
    }
  }

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => "lb/pools/#{pool_id}/health_monitors"
  )
end

#create_floating_ip(floating_network_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/openstack/network/requests/create_floating_ip.rb', line 5

def create_floating_ip(floating_network_id, options = {})
  data = {
    'floatingip' => {
      'floating_network_id' => floating_network_id
    }
  }

  vanilla_options = [:port_id, :tenant_id, :fixed_ip_address, :floating_ip_address, :subnet_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['floatingip'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'floatingips'
  )
end

#create_ike_policy(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_ike_policy.rb', line 5

def create_ike_policy(options = {})
  data = {
    'ikepolicy' => {
    }
  }

  vanilla_options = [:name, :description, :tenant_id,
                     :auth_algorithm, :encryption_algorithm,
                     :pfs, :phase1_negotiation_mode,
                     :lifetime, :ike_version]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['ikepolicy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'vpn/ikepolicies'
  )
end

#create_ipsec_policy(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_ipsec_policy.rb', line 5

def create_ipsec_policy(options = {})
  data = {
    'ipsecpolicy' => {
    }
  }

  vanilla_options = [:name, :description, :tenant_id,
                     :auth_algorithm, :encryption_algorithm,
                     :pfs, :transform_protocol,
                     :lifetime, :encapsulation_mode]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['ipsecpolicy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'vpn/ipsecpolicies'
  )
end

#create_ipsec_site_connection(vpn_service_id, ike_policy_id, ipsec_policy_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/openstack/network/requests/create_ipsec_site_connection.rb', line 5

def create_ipsec_site_connection(vpn_service_id, ike_policy_id, ipsec_policy_id, options = {})
  data = {
    'ipsec_site_connection' => {
      'vpnservice_id'  => vpn_service_id,
      'ikepolicy_id'   => ike_policy_id,
      'ipsecpolicy_id' => ipsec_policy_id
    }
  }

  vanilla_options = [:name, :description, :tenant_id,
                     :peer_address, :peer_id, :peer_cidrs,
                     :psk, :mtu, :dpd, :initiator,
                     :admin_state_up]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['ipsec_site_connection'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'vpn/ipsec-site-connections'
  )
end

#create_lb_health_monitor(type, delay, timeout, max_retries, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/openstack/network/requests/create_lb_health_monitor.rb', line 5

def create_lb_health_monitor(type, delay, timeout, max_retries, options = {})
  data = {
    'health_monitor' => {
      'type'        => type,
      'delay'       => delay,
      'timeout'     => timeout,
      'max_retries' => max_retries
    }
  }

  vanilla_options = [:http_method, :url_path, :expected_codes, :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['health_monitor'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lb/health_monitors'
  )
end

#create_lb_member(pool_id, address, protocol_port, weight, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/openstack/network/requests/create_lb_member.rb', line 5

def create_lb_member(pool_id, address, protocol_port, weight, options = {})
  data = {
    'member' => {
      'pool_id'       => pool_id,
      'address'       => address,
      'protocol_port' => protocol_port,
      'weight'        => weight
    }
  }

  vanilla_options = [:admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['member'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lb/members'
  )
end

#create_lb_pool(subnet_id, protocol, lb_method, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_lb_pool.rb', line 5

def create_lb_pool(subnet_id, protocol, lb_method, options = {})
  data = {
    'pool' => {
      'subnet_id' => subnet_id,
      'protocol'  => protocol,
      'lb_method' => lb_method
    }
  }

  vanilla_options = [:name, :description, :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['pool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lb/pools'
  )
end

#create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/openstack/network/requests/create_lb_vip.rb', line 5

def create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {})
  data = {
    'vip' => {
      'subnet_id'     => subnet_id,
      'pool_id'       => pool_id,
      'protocol'      => protocol,
      'protocol_port' => protocol_port
    }
  }

  vanilla_options = [:name, :description, :address, :session_persistence, :connection_limit,
                     :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['vip'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lb/vips'
  )
end

#create_lbaas_healthmonitor(pool_id, type, delay, timeout, max_retries, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/openstack/network/requests/create_lbaas_healthmonitor.rb', line 5

def create_lbaas_healthmonitor(pool_id, type, delay, timeout, max_retries, options = {})
  data = {
    'healthmonitor' => {
      'pool_id'     => pool_id,
      'type'        => type,
      'delay'       => delay,
      'timeout'     => timeout,
      'max_retries' => max_retries
    }
  }

  vanilla_options = [:http_method, :url_path, :expected_codes, :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['healthmonitor'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lbaas/healthmonitors'
  )
end

#create_lbaas_l7policy(listener_id, action, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/openstack/network/requests/create_lbaas_l7policy.rb', line 5

def create_lbaas_l7policy(listener_id, action, options = {})
  data = {
    'l7policy' => {
      'listener_id'  => listener_id,
      'action'       => action
    }
  }

  vanilla_options = [:tenant_id, :name, :description, :redirect_pool_id, :redirect_url, :position]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['l7policy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lbaas/l7policies'
  )
end

#create_lbaas_l7rule(l7policy_id, type, compare_type, value, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_lbaas_l7rule.rb', line 5

def create_lbaas_l7rule(l7policy_id, type, compare_type, value, options = {})
  data = {
    'rule' => {
      'type'          => type,
      'compare_type'  => compare_type,
      'value'         => value
    }
  }

  vanilla_options = [:tenant_id, :key, :invert]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['rule'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => "lbaas/l7policies/#{l7policy_id}/rules"
  )
end

#create_lbaas_listener(loadbalancer_id, protocol, protocol_port, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/openstack/network/requests/create_lbaas_listener.rb', line 5

def create_lbaas_listener(loadbalancer_id, protocol, protocol_port, options = {})
  data = {
    'listener' => {
      'loadbalancer_id' => loadbalancer_id,
      'protocol'        => protocol,
      'protocol_port'   => protocol_port
    }
  }

  vanilla_options = [:name, :description, :default_pool_id, :connection_limit, :default_tls_container_ref, :sni_container_refs,
                     :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['listener'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lbaas/listeners'
  )
end

#create_lbaas_loadbalancer(vip_subnet_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/openstack/network/requests/create_lbaas_loadbalancer.rb', line 5

def create_lbaas_loadbalancer(vip_subnet_id, options = {})
  data = {
      'loadbalancer' => {
          'vip_subnet_id' => vip_subnet_id
      }
  }
  vanilla_options = [:name, :description, :vip_address, :provider, :flavor, :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['loadbalancer'][key] = options[key]
  end

  request(
      :body => Fog::JSON.encode(data),
      :expects => [201],
      :method => 'POST',
      :path => 'lbaas/loadbalancers'
  )
end

#create_lbaas_pool(listener_id, protocol, lb_algorithm, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_lbaas_pool.rb', line 5

def create_lbaas_pool(listener_id, protocol, lb_algorithm, options = {})
  data = {
    'pool' => {
      'listener_id' => listener_id,
      'protocol'  => protocol,
      'lb_algorithm' => lb_algorithm
    }
  }

  vanilla_options = [:name, :description, :admin_state_up, :session_persistence, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['pool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'lbaas/pools'
  )
end

#create_lbaas_pool_member(pool_id, address, protocol_port, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/openstack/network/requests/create_lbaas_pool_member.rb', line 5

def create_lbaas_pool_member(pool_id, address, protocol_port, options = {})
  data = {
      'member' => {
          'address' => address,
          'protocol_port' => protocol_port
      }
  }

  vanilla_options = [:admin_state_up, :tenant_id, :weight, :subnet_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['member'][key] = options[key]
  end

  request(
      :body => Fog::JSON.encode(data),
      :expects => [201],
      :method => 'POST',
      :path => "lbaas/pools/#{pool_id}/members"
  )
end

#create_network(options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/openstack/network/requests/create_network.rb', line 53

def create_network(options = {})
  data = {}
  data['network'] = self.class.create(options)
  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'networks'
  )
end

#create_port(network_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_port.rb', line 5

def create_port(network_id, options = {})
  data = {
    'port' => {
      'network_id' => network_id,
    }
  }

  vanilla_options = [:name, :fixed_ips, :mac_address, :admin_state_up,
                     :device_owner, :device_id, :tenant_id, :security_groups,
                     :allowed_address_pairs]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['port'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'ports'
  )
end

#create_rbac_policy(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/create_rbac_policy.rb', line 5

def create_rbac_policy(options = {})
  data = {'rbac_policy' => {}}

  vanilla_options = [:object_type, :object_id, :tenant_id, :target_tenant, :action]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['rbac_policy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'rbac-policies'
  )
end

#create_router(name, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/openstack/network/requests/create_router.rb', line 5

def create_router(name, options = {})
  data = {
    'router' => {
      'name' => name,
    }
  }

  vanilla_options = [
    :admin_state_up,
    :tenant_id,
    :network_id,
    :status,
    :subnet_id
  ]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['router'][key] = options[key]
  end

  # remove this in a future
  egi = options[:external_gateway_info]
  if egi
    if egi.kind_of?(Fog::OpenStack::Network::Network)
      Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \
      Please pass  external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]"
      data['router'][:external_gateway_info] = {:network_id => egi.id}
    elsif egi.kind_of?(Hash) && egi[:network_id]
      data['router'][:external_gateway_info] = egi
    else
      raise ArgumentError, 'Invalid external_gateway_info attribute'
    end
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'routers'
  )
end

#create_security_group(options = {}) ⇒ Object

Create a new security group

Parameters

  • options<~Hash>:

    • ‘name’<~String> - Name of the security group

    • ‘description’<~String> - Description of the security group

    • ‘tenant_id’<~String> - TenantId different than the current user, that should own the security group. Only allowed if user has ‘admin’ role.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_groups’<~Array>:

      • ‘id’<~String> - UUID of the security group

      • ‘name’<~String> - Name of the security group

      • ‘description’<~String> - Description of the security group

      • ‘tenant_id’<~String> - Tenant id that owns the security group

      • ‘security_group_rules’<~Array>: - Array of security group rules

        • ‘id’<~String> - UUID of the security group rule

        • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

        • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

        • ‘security_group_id’<~String> - UUID of the parent security group

        • ‘remote_group_id’<~String> - UUID of the remote security group

        • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

        • ‘tenant_id’<~String> - Tenant id that owns the security group rule



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/openstack/network/requests/create_security_group.rb', line 32

def create_security_group(options = {})
  data              = {"security_group" => {}}
  desired_options   = [:name, :description, :tenant_id]
  selected_options  = desired_options.select { |o| options[o] }
  selected_options.each { |key| data["security_group"][key] = options[key] }

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 201,
    :method  => "POST",
    :path    => "security-groups"
  )
end

#create_security_group_rule(security_group_id, direction, options = {}) ⇒ Object

Create a new security group rule

Parameters

  • ‘security_group_id’<~String> - UUID of the parent security group

  • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

  • options<~Hash>:

    • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

    • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

    • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

    • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

    • ‘remote_group_id’<~String> - UUID of the remote security group

    • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

    • ‘tenant_id’<~String> - TenantId different than the current user, that should own the security group. Only allowed if user has ‘admin’ role.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_group_rule’<~Hash>:

      • ‘id’<~String> - UUID of the security group rule

      • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

      • ‘port_range_min’<~String> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘port_range_max’<~String> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

      • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

      • ‘security_group_id’<~String> - UUID of the parent security group

      • ‘remote_group_id’<~String> - UUID of the source security group

      • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

      • ‘tenant_id’<~String> - Tenant id that owns the security group rule



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/openstack/network/requests/create_security_group_rule.rb', line 33

def create_security_group_rule(security_group_id, direction, options = {})
  data            = {"security_group_rule" => {"security_group_id" => security_group_id, "direction" => direction}}
  desired_options = [
    :port_range_min,
    :port_range_max,
    :protocol,
    :ethertype,
    :remote_group_id,
    :remote_ip_prefix,
    :tenant_id
  ]
  selected_options = desired_options.select { |o| options[o] }
  selected_options.each { |key| data["security_group_rule"][key] = options[key] }

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 201,
    :method  => "POST",
    :path    => "security-group-rules"
  )
end

#create_subnet(network_id, cidr, ip_version, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/openstack/network/requests/create_subnet.rb', line 5

def create_subnet(network_id, cidr, ip_version, options = {})
  data = {
    'subnet' => {
      'network_id' => network_id,
      'cidr'       => cidr,
      'ip_version' => ip_version
    }
  }

  vanilla_options = [:name, :gateway_ip, :allocation_pools,
                     :dns_nameservers, :host_routes, :enable_dhcp,
                     :tenant_id]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['subnet'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'subnets'
  )
end

#create_subnet_pool(name, prefixes, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/openstack/network/requests/create_subnet_pool.rb', line 5

def create_subnet_pool(name, prefixes, options = {})
  data = {
    'subnetpool' => {
      'name'     => name,
      'prefixes' => prefixes
    }
  }

  vanilla_options = [:description, :address_scope_id, :shared,
                     :min_prefixlen, :max_prefixlen, :default_prefixlen]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['subnetpool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'subnetpools'
  )
end

#create_vpn_service(subnet_id, router_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/openstack/network/requests/create_vpn_service.rb', line 5

def create_vpn_service(subnet_id, router_id, options = {})
  data = {
    'vpnservice' => {
      'subnet_id' => subnet_id,
      'router_id' => router_id
    }
  }

  vanilla_options = [:name, :description, :admin_state_up, :tenant_id]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['vpnservice'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [201],
    :method  => 'POST',
    :path    => 'vpn/vpnservices'
  )
end

#default_path_prefixObject



448
449
450
# File 'lib/fog/openstack/network.rb', line 448

def default_path_prefix
  'v2.0'
end

#default_service_typeObject



452
453
454
# File 'lib/fog/openstack/network.rb', line 452

def default_service_type
  %w[network]
end

#delete_floating_ip(floating_ip_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_floating_ip.rb', line 5

def delete_floating_ip(floating_ip_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "floatingips/#{floating_ip_id}"
  )
end

#delete_ike_policy(ike_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_ike_policy.rb', line 5

def delete_ike_policy(ike_policy_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "vpn/ikepolicies/#{ike_policy_id}"
  )
end

#delete_ipsec_policy(ipsec_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_ipsec_policy.rb', line 5

def delete_ipsec_policy(ipsec_policy_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "vpn/ipsecpolicies/#{ipsec_policy_id}"
  )
end

#delete_ipsec_site_connection(ipsec_site_connection_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_ipsec_site_connection.rb', line 5

def delete_ipsec_site_connection(ipsec_site_connection_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "vpn/ipsec-site-connections/#{ipsec_site_connection_id}"
  )
end

#delete_lb_health_monitor(health_monitor_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lb_health_monitor.rb', line 5

def delete_lb_health_monitor(health_monitor_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lb/health_monitors/#{health_monitor_id}"
  )
end

#delete_lb_member(member_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lb_member.rb', line 5

def delete_lb_member(member_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lb/members/#{member_id}"
  )
end

#delete_lb_pool(pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lb_pool.rb', line 5

def delete_lb_pool(pool_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lb/pools/#{pool_id}"
  )
end

#delete_lb_vip(vip_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lb_vip.rb', line 5

def delete_lb_vip(vip_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lb/vips/#{vip_id}"
  )
end

#delete_lbaas_healthmonitor(healthmonitor_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_healthmonitor.rb', line 5

def delete_lbaas_healthmonitor(healthmonitor_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/healthmonitors/#{healthmonitor_id}"
  )
end

#delete_lbaas_l7policy(l7policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_l7policy.rb', line 5

def delete_lbaas_l7policy(l7policy_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/l7policies/#{l7policy_id}"
  )
end

#delete_lbaas_l7rule(l7policy_id, l7rule_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_l7rule.rb', line 5

def delete_lbaas_l7rule(l7policy_id, l7rule_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/l7policies/#{l7policy_id}/rules/#{l7rule_id}"
  )
end

#delete_lbaas_listener(listener_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_listener.rb', line 5

def delete_lbaas_listener(listener_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/listeners/#{listener_id}"
  )
end

#delete_lbaas_loadbalancer(loadbalancer_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_loadbalancer.rb', line 5

def delete_lbaas_loadbalancer(loadbalancer_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/loadbalancers/#{loadbalancer_id}"
  )
end

#delete_lbaas_pool(pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_pool.rb', line 5

def delete_lbaas_pool(pool_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/pools/#{pool_id}"
  )
end

#delete_lbaas_pool_member(pool_id, member_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_lbaas_pool_member.rb', line 5

def delete_lbaas_pool_member(pool_id, member_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "lbaas/pools/#{pool_id}/members/#{member_id}"
  )
end

#delete_network(network_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_network.rb', line 5

def delete_network(network_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "networks/#{network_id}"
  )
end

#delete_port(port_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_port.rb', line 5

def delete_port(port_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "ports/#{port_id}"
  )
end

#delete_quota(tenant_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_quota.rb', line 5

def delete_quota(tenant_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "/quotas/#{tenant_id}"
  )
end

#delete_rbac_policy(rbac_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_rbac_policy.rb', line 5

def delete_rbac_policy(rbac_policy_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "rbac-policies/#{rbac_policy_id}"
  )
end

#delete_router(router_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_router.rb', line 5

def delete_router(router_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "routers/#{router_id}"
  )
end

#delete_security_group(security_group_id) ⇒ Object

Delete a security group

Parameters

  • ‘security_group_id’<~String> - UUID of the security group to delete



9
10
11
12
13
14
15
# File 'lib/fog/openstack/network/requests/delete_security_group.rb', line 9

def delete_security_group(security_group_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "security-groups/#{security_group_id}"
  )
end

#delete_security_group_rule(security_group_rule_id) ⇒ Object

Delete a security group rule

Parameters

  • ‘security_group_rule_id’<~String> - UUID of the security group rule to delete



9
10
11
12
13
14
15
# File 'lib/fog/openstack/network/requests/delete_security_group_rule.rb', line 9

def delete_security_group_rule(security_group_rule_id)
  request(
    :expects => 204,
    :method  => "DELETE",
    :path    => "security-group-rules/#{security_group_rule_id}"
  )
end

#delete_subnet(subnet_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_subnet.rb', line 5

def delete_subnet(subnet_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "subnets/#{subnet_id}"
  )
end

#delete_subnet_pool(subnet_pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_subnet_pool.rb', line 5

def delete_subnet_pool(subnet_pool_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "subnetpools/#{subnet_pool_id}"
  )
end

#delete_vpn_service(vpn_service_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/delete_vpn_service.rb', line 5

def delete_vpn_service(vpn_service_id)
  request(
    :expects => 204,
    :method  => 'DELETE',
    :path    => "vpn/vpnservices/#{vpn_service_id}"
  )
end

#disassociate_floating_ip(floating_ip_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/openstack/network/requests/disassociate_floating_ip.rb', line 5

def disassociate_floating_ip(floating_ip_id, options = {})
  data = {
    'floatingip' => {
      'port_id' => nil,
    }
  }

  vanilla_options = [:fixed_ip_address]
  vanilla_options.reject { |o| options[o].nil? }.each do |key|
    data['floatingip'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "floatingips/#{floating_ip_id}"
  )
end

#disassociate_lb_health_monitor(pool_id, health_monitor_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/disassociate_lb_health_monitor.rb', line 5

def disassociate_lb_health_monitor(pool_id, health_monitor_id)
  request(
    :expects => [204],
    :method  => 'DELETE',
    :path    => "lb/pools/#{pool_id}/health_monitors/#{health_monitor_id}"
  )
end

#get_extension(name) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_extension.rb', line 5

def get_extension(name)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "extensions/#{name}"
  )
end

#get_floating_ip(floating_ip_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_floating_ip.rb', line 5

def get_floating_ip(floating_ip_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "floatingips/#{floating_ip_id}"
  )
end

#get_ike_policy(ike_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_ike_policy.rb', line 5

def get_ike_policy(ike_policy_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "vpn/ikepolicies/#{ike_policy_id}"
  )
end

#get_ipsec_policy(ipsec_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_ipsec_policy.rb', line 5

def get_ipsec_policy(ipsec_policy_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "vpn/ipsecpolicies/#{ipsec_policy_id}"
  )
end

#get_ipsec_site_connection(ipsec_site_connection_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_ipsec_site_connection.rb', line 5

def get_ipsec_site_connection(ipsec_site_connection_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "vpn/ipsec-site-connections/#{ipsec_site_connection_id}"
  )
end

#get_lb_health_monitor(health_monitor_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lb_health_monitor.rb', line 5

def get_lb_health_monitor(health_monitor_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lb/health_monitors/#{health_monitor_id}"
  )
end

#get_lb_member(member_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lb_member.rb', line 5

def get_lb_member(member_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lb/members/#{member_id}"
  )
end

#get_lb_pool(pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lb_pool.rb', line 5

def get_lb_pool(pool_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lb/pools/#{pool_id}"
  )
end

#get_lb_pool_stats(pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lb_pool_stats.rb', line 5

def get_lb_pool_stats(pool_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lb/pools/#{pool_id}/stats"
  )
end

#get_lb_vip(vip_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lb_vip.rb', line 5

def get_lb_vip(vip_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lb/vips/#{vip_id}"
  )
end

#get_lbaas_healthmonitor(healthmonitor_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_healthmonitor.rb', line 5

def get_lbaas_healthmonitor(healthmonitor_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/healthmonitors/#{healthmonitor_id}"
  )
end

#get_lbaas_l7policy(l7policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_l7policy.rb', line 5

def get_lbaas_l7policy(l7policy_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/l7policies/#{l7policy_id}"
  )
end

#get_lbaas_l7rule(l7policy_id, l7rule_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_l7rule.rb', line 5

def get_lbaas_l7rule(l7policy_id, l7rule_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/l7policies/#{l7policy_id}/rules/#{l7rule_id}"
  )
end

#get_lbaas_listener(listener_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_listener.rb', line 5

def get_lbaas_listener(listener_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/listeners/#{listener_id}"
  )
end

#get_lbaas_loadbalancer(loadbalancer_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_loadbalancer.rb', line 5

def get_lbaas_loadbalancer(loadbalancer_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/loadbalancers/#{loadbalancer_id}"
  )
end

#get_lbaas_pool(pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_pool.rb', line 5

def get_lbaas_pool(pool_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/pools/#{pool_id}"
  )
end

#get_lbaas_pool_member(pool_id, member_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_lbaas_pool_member.rb', line 5

def get_lbaas_pool_member(pool_id, member_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "lbaas/pools/#{pool_id}/members/#{member_id}"
  )
end

#get_network(network_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_network.rb', line 5

def get_network(network_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "networks/#{network_id}"
  )
end

#get_network_ip_availability(network_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_network_ip_availability.rb', line 5

def get_network_ip_availability(network_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "network-ip-availabilities/#{network_id}"
  )
end

#get_port(port_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_port.rb', line 5

def get_port(port_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "ports/#{port_id}"
  )
end

#get_quota(tenant_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_quota.rb', line 5

def get_quota(tenant_id)
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "/quotas/#{tenant_id}"
  )
end

#get_quotasObject



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_quotas.rb', line 5

def get_quotas
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "/quotas"
  )
end

#get_rbac_policy(rbac_policy_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_rbac_policy.rb', line 5

def get_rbac_policy(rbac_policy_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "rbac-policies/#{rbac_policy_id}"
  )
end

#get_router(router_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_router.rb', line 5

def get_router(router_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "routers/#{router_id}"
  )
end

#get_security_group(security_group_id) ⇒ Object

Get details about a security group

Parameters

  • ‘security_group_id’<~String> - UUID of the security group

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_group’<~Array>:

      • ‘id’<~String> - UUID of the security group

      • ‘name’<~String> - Name of the security group

      • ‘description’<~String> - Description of the security group

      • ‘tenant_id’<~String> - Tenant id that owns the security group

      • ‘security_group_rules’<~Array>: - Array of security group rules

        • ‘id’<~String> - UUID of the security group rule

        • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

        • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

        • ‘security_group_id’<~String> - UUID of the parent security group

        • ‘remote_group_id’<~String> - UUID of the remote security group

        • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

        • ‘tenant_id’<~String> - Tenant id that owns the security group rule



29
30
31
32
33
34
35
# File 'lib/fog/openstack/network/requests/get_security_group.rb', line 29

def get_security_group(security_group_id)
  request(
    :expects => 200,
    :method  => "GET",
    :path    => "security-groups/#{security_group_id}"
  )
end

#get_security_group_rule(security_group_rule_id) ⇒ Object

Get details about a security group rule

Parameters

  • ‘security_group_rule_id’<~String> - UUID of the security group rule

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_group_rule’<~Hash>:

      • ‘id’<~String> - UUID of the security group rule

      • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

      • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

      • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

      • ‘security_group_id’<~String> - UUID of the parent security group

      • ‘remote_group_id’<~String> - UUID of the remote security group

      • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

      • ‘tenant_id’<~String> - Tenant id that owns the security group rule



24
25
26
27
28
29
30
# File 'lib/fog/openstack/network/requests/get_security_group_rule.rb', line 24

def get_security_group_rule(security_group_rule_id)
  request(
    :expects => 200,
    :method  => "GET",
    :path    => "security-group-rules/#{security_group_rule_id}"
  )
end

#get_subnet(subnet_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_subnet.rb', line 5

def get_subnet(subnet_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "subnets/#{subnet_id}"
  )
end

#get_subnet_pool(subnet_pool_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_subnet_pool.rb', line 5

def get_subnet_pool(subnet_pool_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "subnetpools/#{subnet_pool_id}"
  )
end

#get_vpn_service(vpn_service_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/get_vpn_service.rb', line 5

def get_vpn_service(vpn_service_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "vpn/vpnservices/#{vpn_service_id}"
  )
end

#list_extensions(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_extensions.rb', line 5

def list_extensions(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'extensions',
    :query   => filters
  )
end

#list_floating_ips(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_floating_ips.rb', line 5

def list_floating_ips(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'floatingips',
    :query   => filters
  )
end

#list_ike_policies(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_ike_policies.rb', line 5

def list_ike_policies(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'vpn/ikepolicies',
    :query   => filters
  )
end

#list_ipsec_policies(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_ipsec_policies.rb', line 5

def list_ipsec_policies(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'vpn/ipsecpolicies',
    :query   => filters
  )
end

#list_ipsec_site_connections(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_ipsec_site_connections.rb', line 5

def list_ipsec_site_connections(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'vpn/ipsec-site-connections',
    :query   => filters
  )
end

#list_lb_health_monitors(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lb_health_monitors.rb', line 5

def list_lb_health_monitors(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lb/health_monitors',
    :query   => filters
  )
end

#list_lb_members(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lb_members.rb', line 5

def list_lb_members(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lb/members',
    :query   => filters
  )
end

#list_lb_pools(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lb_pools.rb', line 5

def list_lb_pools(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lb/pools',
    :query   => filters
  )
end

#list_lb_vips(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lb_vips.rb', line 5

def list_lb_vips(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lb/vips',
    :query   => filters
  )
end

#list_lbaas_healthmonitors(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_healthmonitors.rb', line 5

def list_lbaas_healthmonitors(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lbaas/healthmonitors',
    :query   => filters
  )
end

#list_lbaas_l7policies(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_l7policies.rb', line 5

def list_lbaas_l7policies(filters = {})
  request(
      :expects => 200,
      :method  => 'GET',
      :path    => "lbaas/l7policies",
      :query   => filters
  )
end

#list_lbaas_l7rules(l7policy_id, filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_l7rules.rb', line 5

def list_lbaas_l7rules(l7policy_id, filters = {})
  request(
      :expects => 200,
      :method  => 'GET',
      :path    => "lbaas/l7policies/#{l7policy_id}/rules",
      :query   => filters
  )
end

#list_lbaas_listeners(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_listeners.rb', line 5

def list_lbaas_listeners(filters = {})
  request(
      :expects => 200,
      :method => 'GET',
      :path => 'lbaas/listeners',
      :query => filters
  )
end

#list_lbaas_loadbalancers(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_loadbalancers.rb', line 5

def list_lbaas_loadbalancers(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lbaas/loadbalancers',
    :query   => filters
  )
end

#list_lbaas_pool_members(pool_id, filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_pool_members.rb', line 5

def list_lbaas_pool_members(pool_id, filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "lbaas/pools/#{pool_id}/members",
    :query   => filters
  )
end

#list_lbaas_pools(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_lbaas_pools.rb', line 5

def list_lbaas_pools(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'lbaas/pools',
    :query   => filters
  )
end

#list_network_ip_availabilitiesObject



5
6
7
8
9
10
11
# File 'lib/fog/openstack/network/requests/list_network_ip_availabilities.rb', line 5

def list_network_ip_availabilities
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "network-ip-availabilities"
  )
end

#list_networks(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_networks.rb', line 5

def list_networks(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'networks',
    :query   => filters
  )
end

#list_ports(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_ports.rb', line 5

def list_ports(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'ports',
    :query   => filters
  )
end

#list_rbac_policies(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_rbac_policies.rb', line 5

def list_rbac_policies(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'rbac-policies',
    :query   => filters
  )
end

#list_routers(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_routers.rb', line 5

def list_routers(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'routers',
    :query   => filters
  )
end

#list_security_group_rules(options = {}) ⇒ Object

List all security group rules

Parameters

  • options<~Hash>:

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_group_rules’<~Array>:

      • ‘id’<~String> - UUID of the security group rule

      • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

      • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

      • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

      • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

      • ‘security_group_id’<~String> - UUID of the parent security group

      • ‘remote_group_id’<~String> - UUID of the remote security group

      • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

      • ‘tenant_id’<~String> - Tenant id that owns the security group rule



24
25
26
27
28
29
30
31
# File 'lib/fog/openstack/network/requests/list_security_group_rules.rb', line 24

def list_security_group_rules(options = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'security-group-rules',
    :query   => options
  )
end

#list_security_groups(options = {}) ⇒ Object

List all security groups

Parameters

  • options<~Hash>:

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • ‘security_groups’<~Array>:

      • ‘id’<~String> - UUID of the security group

      • ‘name’<~String> - Name of the security group

      • ‘description’<~String> - Description of the security group

      • ‘tenant_id’<~String> - Tenant id that owns the security group

      • ‘security_group_rules’<~Array>: - Array of security group rules

        • ‘id’<~String> - UUID of the security group rule

        • ‘direction’<~String> - Direction of traffic, must be in [‘ingress’, ‘egress’]

        • ‘port_range_min’<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘port_range_max’<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard)

        • ‘protocol’<~String> - IP protocol for rule, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘ethertype’<~String> - Type of ethernet support, must be in [‘IPv4’, ‘IPv6’]

        • ‘security_group_id’<~String> - UUID of the parent security group

        • ‘remote_group_id’<~String> - UUID of the remote security group

        • ‘remote_ip_prefix’<~String> - IP cidr range address i.e. ‘0.0.0.0/0’

        • ‘tenant_id’<~String> - Tenant id that owns the security group rule



29
30
31
32
33
34
35
36
# File 'lib/fog/openstack/network/requests/list_security_groups.rb', line 29

def list_security_groups(options = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'security-groups',
    :query   => options
  )
end

#list_subnet_pools(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_subnet_pools.rb', line 5

def list_subnet_pools(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'subnetpools',
    :query   => filters
  )
end

#list_subnets(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_subnets.rb', line 5

def list_subnets(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'subnets',
    :query   => filters
  )
end

#list_vpn_services(filters = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/list_vpn_services.rb', line 5

def list_vpn_services(filters = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => 'vpn/vpnservices',
    :query   => filters
  )
end

#remove_router_interface(router_id, subnet_id, _options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/openstack/network/requests/remove_router_interface.rb', line 5

def remove_router_interface(router_id, subnet_id, _options = {})
  data = {
    'subnet_id' => subnet_id,
  }

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "routers/#{router_id}/remove_router_interface"
  )
end

#set_tenant(tenant) ⇒ Object



5
6
7
8
9
# File 'lib/fog/openstack/network/requests/set_tenant.rb', line 5

def set_tenant(tenant)
  @openstack_must_reauthenticate = true
  @openstack_tenant = tenant.to_s
  authenticate
end

#update_ike_policy(ike_policy_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/openstack/network/requests/update_ike_policy.rb', line 5

def update_ike_policy(ike_policy_id, options = {})
  data = {'ikepolicy' => {}}

  vanilla_options = [:name, :description, :tenant_id,
                     :auth_algorithm, :encryption_algorithm,
                     :pfs, :phase1_negotiation_mode,
                     :lifetime, :ike_version]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['ikepolicy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "vpn/ikepolicies/#{ike_policy_id}"
  )
end

#update_ipsec_policy(ipsec_policy_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/openstack/network/requests/update_ipsec_policy.rb', line 5

def update_ipsec_policy(ipsec_policy_id, options = {})
  data = {'ipsecpolicy' => {}}

  vanilla_options = [:name, :description, :tenant_id,
                     :auth_algorithm, :encryption_algorithm,
                     :pfs, :transform_protocol, :encapsulation_mode,
                     :lifetime, :ipsec_version]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['ipsecpolicy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "vpn/ipsecpolicies/#{ipsec_policy_id}"
  )
end

#update_ipsec_site_connection(ipsec_site_connection_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/openstack/network/requests/update_ipsec_site_connection.rb', line 5

def update_ipsec_site_connection(ipsec_site_connection_id, options = {})
  data = {'ipsec_site_connection' => {}}

  vanilla_options = [:name, :description, :tenant_id,
                     :peer_address, :peer_id, :peer_cidrs,
                     :psk, :mtu, :dpd, :initiator,
                     :admin_state_up, :ikepolicy_id,
                     :ipsecpolicy_id, :vpnservice_id]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['ipsec_site_connection'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "vpn/ipsec-site-connections/#{ipsec_site_connection_id}"
  )
end

#update_lb_health_monitor(health_monitor_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lb_health_monitor.rb', line 5

def update_lb_health_monitor(health_monitor_id, options = {})
  data = {'health_monitor' => {}}

  vanilla_options = [:delay, :timeout, :max_retries, :http_method, :url_path, :expected_codes, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['health_monitor'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lb/health_monitors/#{health_monitor_id}"
  )
end

#update_lb_member(member_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lb_member.rb', line 5

def update_lb_member(member_id, options = {})
  data = {'member' => {}}

  vanilla_options = [:pool_id, :weight, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['member'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lb/members/#{member_id}"
  )
end

#update_lb_pool(pool_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lb_pool.rb', line 5

def update_lb_pool(pool_id, options = {})
  data = {'pool' => {}}

  vanilla_options = [:name, :description, :lb_method, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['pool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lb/pools/#{pool_id}"
  )
end

#update_lb_vip(vip_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lb_vip.rb', line 5

def update_lb_vip(vip_id, options = {})
  data = {'vip' => {}}

  vanilla_options = [:pool_id, :name, :description, :session_persistence, :connection_limit, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['vip'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lb/vips/#{vip_id}"
  )
end

#update_lbaas_healthmonitor(healthmonitor_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lbaas_healthmonitor.rb', line 5

def update_lbaas_healthmonitor(healthmonitor_id, options = {})
  data = {'healthmonitor' => {}}

  vanilla_options = [:name, :delay, :timeout, :max_retries, :http_method, :url_path, :expected_codes, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['healthmonitor'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lbaas/healthmonitors/#{healthmonitor_id}"
  )
end

#update_lbaas_l7policy(l7policy_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/openstack/network/requests/update_lbaas_l7policy.rb', line 5

def update_lbaas_l7policy(l7policy_id, options = {})

  data = {'l7policy' => {}}

  vanilla_options = [:action, :name, :description, :redirect_pool_id, :redirect_url, :position]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['l7policy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "lbaas/l7policies/#{l7policy_id}"
  )
end

#update_lbaas_l7rule(l7policy_id, l7rule_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/openstack/network/requests/update_lbaas_l7rule.rb', line 5

def update_lbaas_l7rule(l7policy_id, l7rule_id, options = {})

  data = { 'rule' => {} }

  vanilla_options = [:type, :compare_type, :key, :value, :invert]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['rule'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => [200],
    :method  => 'PUT',
    :path    => "lbaas/l7policies/#{l7policy_id}/rules/#{l7rule_id}"
  )
end

#update_lbaas_listener(listener_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/openstack/network/requests/update_lbaas_listener.rb', line 5

def update_lbaas_listener(listener_id, options = {})

  data = { 'listener' => {} }

  vanilla_options = [:name, :description, :connection_limit, :default_tls_container_ref, :sni_container_refs,
                     :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['listener'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lbaas/listeners/#{listener_id}"
  )
end

#update_lbaas_loadbalancer(loadbalancer_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/openstack/network/requests/update_lbaas_loadbalancer.rb', line 5

def update_lbaas_loadbalancer(loadbalancer_id, options = {})
  data = {
      'loadbalancer' => {}
  }

  vanilla_options = [:name, :description, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['loadbalancer'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lbaas/loadbalancers/#{loadbalancer_id}"
  )
end

#update_lbaas_pool(pool_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lbaas_pool.rb', line 5

def update_lbaas_pool(pool_id, options = {})
  data = {'pool' => {}}

  vanilla_options = [:name, :description, :lb_algorithm, :session_persistence, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['pool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lbaas/pools/#{pool_id}"
  )
end

#update_lbaas_pool_member(pool_id, member_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_lbaas_pool_member.rb', line 5

def update_lbaas_pool_member(pool_id, member_id, options = {})
  data = {'member' => {}}

  vanilla_options = [:weight, :admin_state_up, :name]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['member'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "lbaas/pools/#{pool_id}/members/#{member_id}"
  )
end

#update_network(network_id, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/fog/openstack/network/requests/update_network.rb', line 32

def update_network(network_id, options = {})
  data = {'network' => self.class.update(options)}
  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "networks/#{network_id}.json"
  )
end

#update_port(port_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/openstack/network/requests/update_port.rb', line 5

def update_port(port_id, options = {})
  data = {'port' => {}}

  vanilla_options = [:name, :fixed_ips, :admin_state_up, :device_owner,
                     :device_id, :security_groups, :allowed_address_pairs]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['port'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "ports/#{port_id}.json"
  )
end

#update_quota(tenant_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/network/requests/update_quota.rb', line 5

def update_quota(tenant_id, options = {})
  request(
    :body    => Fog::JSON.encode('quota' => options),
    :expects => 200,
    :method  => 'PUT',
    :path    => "/quotas/#{tenant_id}"
  )
end

#update_rbac_policy(rbac_policy_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_rbac_policy.rb', line 5

def update_rbac_policy(rbac_policy_id, options = {})
  data = {'rbac_policy' => {}}

  vanilla_options = [:target_tenant]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['rbac_policy'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "rbac-policies/#{rbac_policy_id}"
  )
end

#update_router(router_id, options = {}) ⇒ Object

Update Router

Beyond the name and the administrative state, the only parameter which can be updated with this operation is the external gateway.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/openstack/network/requests/update_router.rb', line 11

def update_router(router_id, options = {})
  data = {'router' => {}}

  [:name, :admin_state_up, :routes].each do |key|
    data['router'][key] = options[key] if options[key]
  end

  # remove this in a future
  egi = options[:external_gateway_info]
  if egi
    if egi.kind_of?(Fog::OpenStack::Network::Network)
      Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \
      Please pass  external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]"
      data['router'][:external_gateway_info] = {:network_id => egi.id}
    elsif egi.kind_of?(Hash)
      data['router'][:external_gateway_info] = egi
    else
      raise ArgumentError, 'Invalid external_gateway_info attribute'
    end
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "routers/#{router_id}.json"
  )
end

#update_security_group(security_group_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/openstack/network/requests/update_security_group.rb', line 5

def update_security_group(security_group_id, options = {})
  data = {'security_group' => {}}

  [:name, :description].each do |key|
    data['security_group'][key] = options[key] if options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "security-groups/#{security_group_id}"
  )
end

#update_subnet(subnet_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/openstack/network/requests/update_subnet.rb', line 5

def update_subnet(subnet_id, options = {})
  data = {'subnet' => {}}

  vanilla_options = [:name, :gateway_ip, :allocation_pools,
                     :dns_nameservers, :host_routes, :enable_dhcp]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['subnet'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "subnets/#{subnet_id}"
  )
end

#update_subnet_pool(subnet_pool_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/openstack/network/requests/update_subnet_pool.rb', line 5

def update_subnet_pool(subnet_pool_id, options = {})
  data = {'subnetpool' => {}}

  vanilla_options = [:name, :description, :prefixes, :address_scope_id,
                     :min_prefixlen, :max_prefixlen, :default_prefixlen]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['subnetpool'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "subnetpools/#{subnet_pool_id}"
  )
end

#update_vpn_service(vpn_service_id, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/openstack/network/requests/update_vpn_service.rb', line 5

def update_vpn_service(vpn_service_id, options = {})
  data = {'vpnservice' => {}}

  vanilla_options = [:name, :description, :admin_state_up]
  vanilla_options.select { |o| options.key?(o) }.each do |key|
    data['vpnservice'][key] = options[key]
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => 'PUT',
    :path    => "vpn/vpnservices/#{vpn_service_id}"
  )
end