Sha256: 577bf62e9023f45d911481ea71a29a2e67bcd33d70acd49d9ed862bd84c588c6

Contents?: true

Size: 598 Bytes

Versions: 28

Compression:

Stored size: 598 Bytes

Contents

module Kontena::Cli::Grids::TrustedSubnets
  class RemoveCommand < Clamp::Command
    include Kontena::Cli::Common

    parameter "NAME", "Grid name"
    parameter "SUBNET", "Trusted subnet"

    def execute
      require_api_url
      token = require_token
      grid = client(token).get("grids/#{name}")
      trusted_subnets = grid['trusted_subnets'] || []
      unless trusted_subnets.delete(self.subnet)
        abort("Grid does not have trusted subnet #{self.subnet}")
      end
      data = {trusted_subnets: trusted_subnets}
      client(token).put("grids/#{name}", data)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.4 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.3 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.2 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.1 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.0 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.7 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.6 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.5 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.4 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.3 lib/kontena/cli/grids/trusted_subnets/remove_command.rb
kontena-cli-0.14.2 lib/kontena/cli/grids/trusted_subnets/remove_command.rb