addons:attach ADDON_NAME

 attach add-on resource to an app

 --as ATTACHMENT_NAME  # (optional) name for add-on attachment
 --confirm APP_NAME    # overwrite existing add-on attachment with same name
3785
def attach
      unless addon_name = args.shift
        error("Usage: heroku addons:attach ADDON_NAME\nMust specify add-on resource to attach.")
      end
      addon = resolve_addon!(addon_name)

      requires_preauth

      attachment_name = options[:as]

      msg = attachment_name ?
        "Attaching #{addon['name']} as #{attachment_name} to #{app}" :
        "Attaching #{addon['name']} to #{app}"

      display("#{msg}... ", false)

      response = api.request(
        :body     => json_encode({
          "app"     => {"name" => app},
          "addon"   => {"name" => addon['name']},
          "confirm" => options[:confirm],
          "name"    => attachment_name
        }),
        :expects  => [201, 422],
        :headers  => { "Accept" => "application/vnd.heroku+json; version=3" },
        :method   => :post,
        :path     => "/addon-attachments"
      )

      case response.status
      when 201
        display("done")
        action("Setting #{response.body["name"]} vars and restarting #{app}") do
          @status = api.get_release(app, 'current').body['name']
        end
      when 422 # add-on resource not found or cannot be attached
        display("failed")
        output_with_bang(response.body["message"])
        output_with_bang("List available resources with `heroku addons`.")
        output_with_bang("Provision a new add-on resource with `heroku addons:create ADDON_PLAN`.")
      end
    end
244538
def rename(self, name):
        """"""

        r = self._h._http_resource(
            method='PUT',
            resource=('apps', self.name),
            data={'app[name]': name}
        )
        return r.ok
1295520
def put_attachment(name, file, options={})
      raise ArgumentError, "doc must be saved" unless self.rev
      raise ArgumentError, "doc.database required to put_attachment" unless database
      result = database.put_attachment(self, name, file, options)
      self['_rev'] = result['rev']
      result['ok']
    end
762459
def add_if_unique(self, name):
        
        with self.lock:
            if name not in self.names:
                self.names.append(name)
                return True
        return False
923733
function _addPlugin(app, item) {
  if (!item.name || item.name === '') {
    try {
      if (typeof item.fn.publicName === 'string') item.name = item.fn.publicName;
    } catch (e) {
    }
  }
  item.name = item.name.trim();
  if (item.name.indexOf('thorin-plugin-') === 0) {  // thorin plugins have their name trimmed.
    item.name = item.name.substr(14);
  }
  let pluginConfig = app.config('plugin.' + item.name);
  if (pluginConfig) {
    item.opt = app.util.extend(pluginConfig, item.opt);
  }
  if (typeof item.fn === 'string') {
    item.fn = _requireModule(app.root, item.fn, item.opt);
  }
  if (typeof app[plugins][item.name] !== 'undefined') {
    throw new Error('Thorin.addPlugin: plugin ' + item.name + " is already registered. Please use a different name.");
  }
  /* Check if we have a constructor or an already created obj. */
  let pluginType = Object.prototype.toString.call(item.fn),
    pluginObj;
  if (pluginType === '[object Undefined]') {
    return; // we do not add it.
  }
  if (pluginType === '[object Object]') {
    pluginObj = item.fn;
    item.name = item.fn.name;
  } else if (typeof item.fn === 'function') {
    try {
      pluginObj = new item.fn(app, item.opt, item.name);
    } catch (e) {
      if (e.message.indexOf('item.fn is not a constructor') === 0) {
        pluginObj = item.fn(app, item.opt, item.name);
        if (typeof pluginObj !== 'object' || !pluginObj) return;
      } else {
        throw e;
      }
    }
  }
  app[plugins][item.name] = pluginObj;
}
1299157
def add_single_resource(self, ref, **properties):
        

        t = self.doc.find_first('Root.Datafile', value=ref)

        if t:
            self.prt("Datafile exists for '{}', deleting".format(ref))
            self.doc.remove_term(t)

        term_name = self.classify_url(ref)

        ref, path, name = self.extract_path_name(ref)

        self.prt("Adding resource for '{}'".format(ref))

        try:
            encoding, ri = self.run_row_intuit(path, self._cache)
        except Exception as e:
            self.warn("Failed to intuit '{}'; {}".format(path, e))
            return None

        if not name:

            name = sha1(slugify(path).encode('ascii')).hexdigest()[:12]

            # xlrd gets grouchy if the name doesn't start with a char
            try:
                int(name[0])
                name = 'a' + name[1:]
            except:
                pass

        if 'name' in properties:
            name = properties['name']
            del properties['name']

        return self.sections.resources.new_term(term_name, ref, name=name,
                                                startline=ri.start_line,
                                                headerlines=','.join(str(e) for e in ri.header_lines),
                                                encoding=encoding,
                                                **properties)
1363912
public AddonChange removeAddon(String appName, String addonName) {
        return connection.execute(new AddonRemove(appName, addonName), apiKey);
    }
804183
def add_source_override(self, fullname, path, source, is_pkg):
        
        self._finder.add_source_override(fullname, path, source, is_pkg)
1111392
def add_attachment(attachment, name = '')
      # Is it a file object or a string (url)?
      if attachment.respond_to?(:path) && attachment.respond_to?(:read)
        client.post("/cards/#{id}/attachments", {
            file: attachment,
            name: name
          })
      else
        client.post("/cards/#{id}/attachments", {
            url: attachment,
            name: name
          })
      end
    end
1216061
def add_form(self, form, form_name, form_args):
        
        self.parentApp.addForm(form_name, form, **form_args)
        self.parentApp.change_form(form_name)
        return
1221867
def attach(options = {})
      options = Aws::Util.deep_merge(options,
        auto_scaling_group_name: @group_name,
        instance_ids: [@id]
      )
      resp = @client.attach_instances(options)
      resp.data
    end
701061
def put_attachment(doc, name, file, options = {})
      file = StringIO.new(file) if file.is_a?(String)
      connection.put path_for_attachment(doc, name), file, options
    end
902392
def add(self, resource, replace=False):
        """"""
        uri = resource.uri
        for r in self:
            if (uri == r.uri):
                if (replace):
                    r = resource
                    return
                else:
                    raise ResourceListDupeError(
                        "Attempt to add resource already in resource_list")
        # didn't find it in list, add to end
        self.append(resource)
365102
function() {
    return this._findInRepoAddons().reduce((acc, addon) => {
      let addonDir = path.join(this.project.root, 'lib', addon.name);
      let addonAppDir = path.join(addonDir, 'app');
      let addonAddonDir = path.join(addonDir, 'addon');
      const addonAddonTestSupportDir = path.join(addonDir, 'addon-test-support');
      return concat(
        acc,
        this._getIncludesForDir(addonAppDir, this.parent.name()),
        this._getIncludesForDir(addonAddonDir, addon.name),
        this._getIncludesForDir(addonAddonTestSupportDir, `${addon.name}/test-support`)
      );
    }, []);
  }
676277
def render_app_name(context, app, template="/admin_app_name.html"):
    
    try:
        template = app['app_label'] + template
        text = render_to_string(template, context)
    except:
        text = app['name']
    return text
1140650
def add_attachment(self, attachment):
        
        log = logging.getLogger(self.cls_logger + '.add_attachment')
        if not isinstance(attachment, SlackAttachment):
            msg = 'attachment must be of type: SlackAttachment'
            log.error(msg)
            raise ValueError(msg)
        self.attachments.append(attachment.attachment)
        log.debug('Added attachment: {a}'.format(a=attachment))
965758
def get_addon_name(addonxml):
    ''''''
    xml = parse(addonxml)
    addon_node = xml.getElementsByTagName('addon')[0]
    return addon_node.getAttribute('name')