def upgrade
      addon_name, plan = args.shift, args.shift

      if addon_name && !plan # If invocated as `addons:Xgrade service:plan`
        deprecate("No add-on name specified (see `heroku help #{current_command}`)")

        addon = nil
        plan = addon_name
        service = plan.split(':').first

        action("Finding add-on from service #{service} on app #{app}") do
          # resolve with the service only, because the user has passed in the
          # *intended* plan, not the current plan.
          addon = resolve_addon!(service)
          addon_name = addon['name']
        end
        display "Found #{addon_name} (#{addon['plan']['name']}) on #{app}."
      else
        raise CommandFailed.new("Missing add-on name") if addon_name.nil?
        addon_name = addon_name.sub(/^@/, '')
      end

      raise CommandFailed.new("Missing add-on plan") if plan.nil?

      action("Changing #{addon_name} plan to #{plan}") do
        @addon = api.request(
          :body     => json_encode({
            "plan"   => { "name" => plan }
          }),
          :expects  => 200..300,
          :headers  => {
            "Accept" => "application/vnd.heroku+json; version=3",
            "Accept-Expansion" => "plan",
            "X-Heroku-Legacy-Provider-Messages" => "true"
          },
          :method   => :patch,
          :path     => "/apps/#{app}/addons/#{addon_name}"
        ).body
        @status = "(#{format_price @addon['plan']['price']})" if @addon['plan'].has_key?('price')
      end
      display @addon['provision_message'] unless @addon['provision_message'].to_s.strip == ""
    end
def upgrade
      addon_name, plan = args.shift, args.shift

      if addon_name && !plan # If invocated as `addons:Xgrade service:plan`
        deprecate("No add-on name specified (see `heroku help #{current_command}`)")

        addon = nil
        plan = addon_name
        service = plan.split(':').first

        action("Finding add-on from service #{service} on app #{app}") do
          # resolve with the service only, because the user has passed in the
          # *intended* plan, not the current plan.
          addon = resolve_addon!(service)
          addon_name = addon['name']
        end
        display "Found #{addon_name} (#{addon['plan']['name']}) on #{app}."
      else
        raise CommandFailed.new("Missing add-on name") if addon_name.nil?
        addon_name = addon_name.sub(/^@/, '')
      end

      raise CommandFailed.new("Missing add-on plan") if plan.nil?

      action("Changing #{addon_name} plan to #{plan}") do
        @addon = api.request(
          :body     => json_encode({
            "plan"   => { "name" => plan }
          }),
          :expects  => 200..300,
          :headers  => {
            "Accept" => "application/vnd.heroku+json; version=3",
            "Accept-Expansion" => "plan",
            "X-Heroku-Legacy-Provider-Messages" => "true"
          },
          :method   => :patch,
          :path     => "/apps/#{app}/addons/#{addon_name}"
        ).body
        @status = "(#{format_price @addon['plan']['price']})" if @addon['plan'].has_key?('price')
      end
      display @addon['provision_message'] unless @addon['provision_message'].to_s.strip == ""
    end
addons:upgrade ADDON_NAME ADDON_SERVICE:PLAN

 upgrade an existing add-on resource to PLAN