Sha256: e43fe677e1ae30de88c2c6a9112ff17591bd05ccd36f831e4f322a1af5a8e638

Contents?: true

Size: 905 Bytes

Versions: 6

Compression:

Stored size: 905 Bytes

Contents

module Brightbox
  class ConfigMap < Api
    def self.require_account?; true; end

    def self.all
      conn.config_maps
    end

    def self.create(options)
      new(conn.config_maps.create(options))
    end

    def self.get(id)
      conn.config_maps.get(id)
    end

    def self.default_field_order
      %i[id name]
    end

    def self.detailed_fields
      %i[
        id
        name
      ]
    end

    def format_data(format)
      case format.to_sym
      when :text
        attributes[:data].map do |key, value|
          "#{key.to_s.rjust(16)}: #{value}"
        end.join("\n")
      else
        JSON.dump(data)
      end
    end

    def to_row
      {
        id: attributes[:id],
        name: attributes[:name],
        data: attributes[:data]
      }
    end

    def update(options)
      self.class.conn.update_config_map(id, options)
      reload
      self
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
brightbox-cli-4.8.0 lib/brightbox-cli/config_map.rb
brightbox-cli-4.7.0 lib/brightbox-cli/config_map.rb
brightbox-cli-4.6.0 lib/brightbox-cli/config_map.rb
brightbox-cli-4.5.0 lib/brightbox-cli/config_map.rb
brightbox-cli-4.5.0.rc1 lib/brightbox-cli/config_map.rb
brightbox-cli-4.4.0 lib/brightbox-cli/config_map.rb