Sha256: c0ba1c9ddb5578e2c04fcd9e8e1935e951207505973fdedb35c6b59a7ad38687
Contents?: true
Size: 964 Bytes
Versions: 8
Compression:
Stored size: 964 Bytes
Contents
# coding: utf-8 require "milc/gcloud/compute" require 'active_support/core_ext/array/wrap' module Milc module Gcloud module Compute module Instances def build_attr_arg(attr_name, value) case attr_name when :disk, :disks then disks = Array.wrap(value).map{|d| d.is_a?(Hash) ? build_sub_attr_args(d) : d.to_s } disks.map{|d| "--disk #{d}"}.join(" ") else super(attr_name, value) end end def first_internal_ip(network_interfaces) network_interfaces.map{|i| i["networkIP"]}.compact.first end module_function :first_internal_ip def first_external_ip(network_interfaces) network_interfaces.map{|i| configs = i["accessConfigs"] || [] configs.map{|c| c["natIP"] }.compact.first }.flatten.first end module_function :first_external_ip end end end end
Version data entries
8 entries across 8 versions & 1 rubygems