Sha256: 4b772da9d7bd260757eb030ad6cee26d9d21d97144f16d5a46779660b758d2e3
Contents?: true
Size: 1.96 KB
Versions: 20
Compression:
Stored size: 1.96 KB
Contents
module Fog module Compute class Google class Mock def insert_firewall(_firewall_name, _options = {}) Fog::Mock.not_implemented end end class Real INSERTABLE_FIREWALL_FIELDS = %i{ allowed denied description destination_ranges direction name network priority source_ranges source_service_accounts source_tags target_service_accounts target_tags }.freeze ## # Create a Firewall resource # # @param [Hash] opts The firewall object to create # @option opts [Array<Hash>] allowed # @option opts [Array<Hash>] denied # @option opts [String] description # @option opts [Array<String>] destination_ranges # @option opts [String] direction # @option opts [String] name # @option opts [String] network # @option opts [Fixnum] priority # @option opts [Array<String>] source_ranges # @option opts [Array<String>] source_service_accounts # @option opts [Array<String>] source_tags # @option opts [Array<String>] target_service_accounts # @option opts [Array<String>] target_tags # # @see https://cloud.google.com/compute/docs/reference/latest/firewalls/insert def insert_firewall(firewall_name, opts = {}) if opts.key?(:network) && !opts[:network].empty? unless opts[:network].start_with?("http://", "https://", "projects/", "global/") opts[:network] = "projects/#{@project}/global/networks/#{opts[:network]}" end end opts = opts.select { |k, _| INSERTABLE_FIREWALL_FIELDS.include? k } .merge(:name => firewall_name) @compute.insert_firewall( @project, ::Google::Apis::ComputeV1::Firewall.new(opts) ) end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems