Remove a template
@param client Elasticsearch client
@param template template name
@deprecated Will be removed when we don't support TransportClient anymore
513584
@Deprecated
	public static void removeTemplate(Client client, String template) {
		logger.trace("removeTemplate({})", template);
		client.admin().indices().prepareDeleteTemplate(template).get();
		logger.trace("/removeTemplate({})", template);
	}
424807
public static void deleteMetadataTemplate(BoxAPIConnection api, String scope, String template) {

        URL url = METADATA_TEMPLATE_URL_TEMPLATE.build(api.getBaseURL(), scope, template);
        BoxJSONRequest request = new BoxJSONRequest(api, url, "DELETE");

        request.send();
    }
878320
def index_template_absent(name):
    '''
    
    '''

    ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}

    try:
        index_template = __salt__['elasticsearch.index_template_get'](name=name)
        if index_template and name in index_template:
            if __opts__['test']:
                ret['comment'] = 'Index template {0} will be removed'.format(name)
                ret['changes']['old'] = index_template[name]
                ret['result'] = None
            else:
                ret['result'] = __salt__['elasticsearch.index_template_delete'](name=name)
                if ret['result']:
                    ret['comment'] = 'Successfully removed index template {0}'.format(name)
                    ret['changes']['old'] = index_template[name]
                else:
                    ret['comment'] = 'Failed to remove index template {0} for unknown reasons'.format(name)
        else:
            ret['comment'] = 'Index template {0} is already absent'.format(name)
    except Exception as err:
        ret['result'] = False
        ret['comment'] = six.text_type(err)

    return ret
1221754
private static void createTemplateWithJsonInElasticsearch(RestClient client, String template, String json) throws Exception {
		logger.trace("createTemplate([{}])", template);

		assert client != null;
		assert template != null;

		Request request = new Request("PUT", "/_template/" + template);
		request.setJsonEntity(json);
		Response response = client.performRequest(request);

		if (response.getStatusLine().getStatusCode() != 200) {
			logger.warn("Could not create template [{}]", template);
			throw new Exception("Could not create template ["+template+"].");
		}

		logger.trace("/createTemplate([{}])", template);
	}
1341819
public Result readTemplate(String template,
                               boolean delete) {
        Result result = getFromResultPool();
        ValueSet vs = null;
        if (template == null) {
            return result;
        }
        if (!this.disableTemplatesSupport) {
            if (delayOffload) {
                vs = auxTemplateDependencyTable.getEntries(template);
                if (vs == null) {
                    Result other = readValueSet(TEMPLATE_ID_DATA, template, delete);
                    result.copy(other);
                    returnToResultPool(other);
                    if (result.returnCode != DISK_EXCEPTION) {
                        vs = (ValueSet) result.data;
                        if (vs != null) {
                            if (delete == !DELETE && vs.size() <= auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                                result.returnCode = auxTemplateDependencyTable.add(template, vs);
                            }
                        }
                    }
                } else {
                    if (delete == DELETE) {
                        auxTemplateDependencyTable.removeDependency(template);
                        result.returnCode = delValueSet(TEMPLATE_ID_DATA, template);
                    }
                }
            } else {
                Result other = readValueSet(TEMPLATE_ID_DATA, template, delete);
                result.copy(other);
                returnToResultPool(other);
                vs = (ValueSet) result.data;
            }
            if (result.returnCode != DISK_EXCEPTION && vs != null) {
                this.invalidationBuffer.filter(vs);
            }
            result.data = vs;
        }
        return result;
    }
686104
def delete_sp_template_for_vlan(self, vlan_id):
        """"""
        with self.session.begin(subtransactions=True):
            try:
                self.session.query(
                    ucsm_model.ServiceProfileTemplate).filter_by(
                    vlan_id=vlan_id).delete()
            except orm.exc.NoResultFound:
                return
965589
public void deleteMetadata(String templateName) {
        String scope = Metadata.scopeBasedOnType(templateName);
        this.deleteMetadata(templateName, scope);
    }
55218
@RequestMapping(value = "branches/{branchId}/template/instance", method = RequestMethod.DELETE)
    public Branch disconnectTemplateInstance(@PathVariable ID branchId) {
        return branchTemplateService.disconnectTemplateInstance(branchId);
    }
1093110
def unindex_template(self, tpl):
        
        name = getattr(tpl, 'name', '')
        try:
            del self.name_to_template[name]
        except KeyError:  # pragma: no cover, simple protection
            pass
683624
def search_template_delete(id, hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        result = es.delete_template(id=id)

        return result.get('acknowledged', False)
    except elasticsearch.NotFoundError:
        return True
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot delete search template {0}, server returned code {1} with message {2}".format(id, e.status_code, e.error))
748595
TemplateTypeMap remove(Set<TemplateType> toRemove) {
    ImmutableList.Builder<TemplateType> keys = ImmutableList.builder();
    keys.addAll(templateKeys.subList(0, templateValues.size()));
    for (int i = templateValues.size(); i < templateKeys.size(); i++) {
      TemplateType key = templateKeys.get(i);
      if (!toRemove.contains(key)) {
        keys.add(key);
      }
    }
    return registry.createTemplateTypeMap(keys.build(), templateValues);
  }
491296
public static ns_configtemplate delete(nitro_service client, ns_configtemplate resource) throws Exception
	{
		resource.validate("delete");
		return ((ns_configtemplate[]) resource.delete_resource(client))[0];
	}
600034
@Deprecated
    public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, Template template, ImmutableList<?> args) {
        return new DslTemplate<T>(cl, template, args);
    }
1354305
def _get_resources_to_remove(resource, template):
    
    type_ids = [tmpltype.id for tmpltype in template.templatetypes]

    node_attr_ids = dict([(ra.attr_id, ra) for ra in resource.attributes])
    attrs_to_remove = []
    attrs_to_keep   = []
    for nt in resource.types:
        if nt.templatetype.id in type_ids:
            for ta in nt.templatetype.typeattrs:
                if node_attr_ids.get(ta.attr_id):
                    attrs_to_remove.append(node_attr_ids[ta.attr_id])
        else:
            for ta in nt.templatetype.typeattrs:
                if node_attr_ids.get(ta.attr_id):
                    attrs_to_keep.append(node_attr_ids[ta.attr_id])
    #remove any of the attributes marked for deletion as they are
    #marked for keeping based on being in another type.
    final_attrs_to_remove = set(attrs_to_remove) - set(attrs_to_keep)

    return list(final_attrs_to_remove)
1016445
def destroy_template(name=None, call=None, kwargs=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The destroy_template function must be called with  -f.'
        )
    if kwargs is None:
        kwargs = {}
    name = kwargs.get('name', None)
    session = _get_session()
    vms = session.xenapi.VM.get_all_records()
    ret = {}
    found = False
    for vm in vms:
        record = session.xenapi.VM.get_record(vm)
        if record['is_a_template']:
            if record['name_label'] == name:
                found = True
                # log.debug(record['name_label'])
                session.xenapi.VM.destroy(vm)
                ret[name] = {'status': 'destroyed'}
    if not found:
        ret[name] = {'status': 'not found'}
    return ret
94567
def delete_template(template_id,**kwargs):
    
    try:
        tmpl = db.DBSession.query(Template).filter(Template.id==template_id).one()
    except NoResultFound:
        raise ResourceNotFoundError("Template %s not found"%(template_id,))
    db.DBSession.delete(tmpl)
    db.DBSession.flush()
    return 'OK'
956301
@Deprecated
    public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) {
        return dslTemplate(cl, createTemplate(template), args);
    }