Sha256: 6cade5bba46b30c45051daaeffb220ccb3f3e7694caa2b35ce9082f1f9cf4e2c

Contents?: true

Size: 1.43 KB

Versions: 20

Compression:

Stored size: 1.43 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def update_firewall(_firewall_name, _firewall_opts = {})
          Fog::Mock.not_implemented
        end
      end

      class Real
        UPDATABLE_FIREWALL_FIELDS = %i{
          allowed
          description
          source_ranges
          source_service_accounts
          source_tags
          target_service_accounts
          target_tags
        }.freeze

        ##
        # Update a Firewall resource.
        #
        # Only the following fields can/will be changed.
        #
        # @param [Hash] opts The firewall object to create
        # @option opts [Array<Hash>] allowed
        # @option opts [String] description
        # @option opts [Array<String>] destination_ranges
        # @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 update_firewall(firewall_name, opts = {})
          opts = opts.select { |k, _| UPDATABLE_FIREWALL_FIELDS.include? k }
          @compute.update_firewall(
            @project, firewall_name,
            ::Google::Apis::ComputeV1::Firewall.new(opts)
          )
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
fog-google-1.9.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.9.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.8.2 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.8.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.8.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.7.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.7.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.6.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.5.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.4.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.3.3 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.3.2 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.3.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.3.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.2.2 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.2.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.2.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.1.0 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.0.1 lib/fog/compute/google/requests/update_firewall.rb
fog-google-1.0.0 lib/fog/compute/google/requests/update_firewall.rb