Class: Glb::Lb::ForwardingRule

Inherits:
Resource show all
Defined in:
lib/glb/lb/forwarding_rule.rb

Direct Known Subclasses

ForwardingRuleHttps

Instance Attribute Summary

Attributes inherited from CLI::Base

#options

Instance Method Summary collapse

Methods inherited from Resource

#action, #args, #config, #down, #down_command, #empty_update?, #exist?, #format_option, #gcloud_compute_command, #installed?, #invalid?, #invalid_command?, #region_option, #resource_config, #resource_name, #resource_type, #show, #up, #up_command, #valid?

Methods included from Names

#backend_service_name, #build_name, #firewall_rule_name, #forwarding_rule_https_name, #forwarding_rule_name, #health_check_name, #network, #target_http_proxy_name, #target_https_proxy_name, #url_map_name

Methods included from Util::Sure

#sure?

Methods inherited from CLI::Base

#initialize, #region

Methods included from Util::Sh

#capture, #sh

Constructor Details

This class inherits a constructor from Glb::CLI::Base

Instance Method Details

#default_optionsObject



3
4
5
6
7
# File 'lib/glb/lb/forwarding_rule.rb', line 3

def default_options
  {
    target_http_proxy: target_http_proxy_name,
  }
end

#show_ipObject



9
10
11
12
13
14
# File 'lib/glb/lb/forwarding_rule.rb', line 9

def show_ip
  out = capture "gcloud compute forwarding-rules describe #{resource_name} #{region_option} --format json", show_command: false
  ip = JSON.parse(out)["IPAddress"]
  name = self.class.name.split('::').last.underscore.humanize
  puts "#{name} ip: #{ip}"
end