Delete a source

    source : string
        source url to delete

    .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' imgadm.source_delete https://updates.joyent.com
435673
def source_delete(source):
    '''
    
    '''
    ret = {}
    cmd = 'imgadm sources -d {0}'.format(source)
    res = __salt__['cmd.run_all'](cmd)
    retcode = res['retcode']
    if retcode != 0:
        ret['Error'] = _exit_status(retcode, res['stderr'])
        return ret

    return sources(False)
819933
def delete_source_map(srcmap_file, names, logger=None):
    
    with fits.open(srcmap_file) as hdulist:
        hdunames = [hdu.name.upper() for hdu in hdulist]

        if not isinstance(names, list):
            names = [names]

        for name in names:
            if not name.upper() in hdunames:
                continue
            del hdulist[name.upper()]

        hdulist.writeto(srcmap_file, overwrite=True)
1175071
def delete(self, url, headers=None, kwargs=None):
        
        return self._request(
            method='delete',
            url=url,
            headers=headers,
            kwargs=kwargs
        )
1339242
def delete(url, options = {})
      connection(url, options) do |uri, conn|
        conn.delete(uri.request_uri, options)
      end
    end
310418
function( url ){

			/* The id of the source element is programmed with the
				url of the plugin to remove. */
				
			// TODO: Should be internationalized
				
			var confirmMessage = i18nUtil.formatMessage(messages["UninstallCfrm"],url); //$NON-NLS-1$
			this.dialogService.confirm(confirmMessage, function(result){
				if(result){
					this.forceRemove(url);
				}
			}.bind(this));
		}
346506
def delete_cli(access_token, project_member_id, base_url=OH_BASE_URL,
               file_basename=None, file_id=None, all_files=False):
    
    response = delete_file(access_token, project_member_id,
                           base_url, file_basename, file_id, all_files)
    if (response.status_code == 200):
        print("File deleted successfully")
    else:
        print("Bad response while deleting file.")
669292
def delete_data_source(self, data_source):
        
        source_type = [k for k in data_source.keys()][0]
        complete_source = self.get_data_sources(
            source_id=data_source[source_type]['id'])
        folder_id = complete_source[source_type][0]['l']
        self.delete_folders(folder_ids=[folder_id])
        return self.request('DeleteDataSource', data_source)
731208
def delete(self, url, data=None, params=None):
        
        return self.request("delete", url, data, params)
703442
def delete_url_link(obj, **kwargs):
    
    if hasattr(obj, 'get_delete_url_link'):
        return obj.get_delete_url_link(**kwargs)

    delete_url = obj.get_delete_url()
    return build_link(href=delete_url, **kwargs)
652138
def _api_delete(self, url, **kwargs):
        
        kwargs['url'] = self.url + url
        kwargs['auth'] = self.auth

        headers = deepcopy(self.headers)
        headers.update(kwargs.get('headers', {}))
        kwargs['headers'] = headers
        self._delete(**kwargs)
1098846
def delete(url, params={}, options={})
      response = connection.delete do |req|
        req.saddle_options = options
        req.url(url, params)
      end
      handle_response(response)
    end
1076568
def delete_link(*args)
      options = {:method => :delete, :confirm => "Are you sure you want to delete this?"}.merge(extract_options_from_args!(args)||{})
      args << options
      link_to(*args)
    end
827011
def remove_handler(args):
    

    repo = _open_repo(args)
    anchor_id, anchor = _get_anchor(repo, args['<anchor-id>'])
    del repo[anchor_id]

    return ExitCode.OK
372062
def delete_source(self, id):
        
        # Set the index
        self.catalog.set_index('id')
        
        # Exclude the unwanted source
        self.catalog = self.catalog[self.catalog.id!=id]
        
        # Remove the records from the catalogs
        for cat_name in self.catalogs:
            new_cat = getattr(self, cat_name)[getattr(self, cat_name).source_id!=id]
            print('{} records removed from {} catalog'.format(int(len(getattr(self, cat_name))-len(new_cat)), cat_name))
            setattr(self, cat_name, new_cat)
1224048
def delete_file(path)
      Jekyll.logger.debug "DELETING:", path
      FileUtils.rm_f sanitized_path(path)
      site.process
    end
807556
def delete_source(self, photo, **kwds):
        
        return self._client.post("/photo/%s/source/delete.json" %
                                 self._extract_id(photo),
                                 **kwds)["result"]
29959
private String _delete(nitro_service service, String req_args) throws Exception
	{
		StringBuilder responseStr = new StringBuilder();
		HttpURLConnection httpURLConnection = null;
		try
		{
			String urlstr;
			String ipaddress = service.get_ipaddress();
			String version = service.get_version();
			String sessionid = service.get_sessionid();
			String objtype = get_object_type();
			String protocol = service.get_protocol();
			// build URL
			urlstr = protocol + "://" + ipaddress + "/nitro/" + version + "/config/" + objtype;

			String name = this.get_object_id();
			if (name != null && name.length() > 0)
			{
				urlstr = urlstr + "/" + nitro_util.encode(nitro_util.encode(name));
			}

			/*if(req_args != null && req_args.length() > 0)
			{
				urlstr = urlstr + "?args=" + req_args;
			}*/

			URL url = new URL(urlstr);
			httpURLConnection = (HttpURLConnection) url.openConnection();

			httpURLConnection.setRequestMethod("DELETE");

			if(sessionid != null)
			{
				httpURLConnection.setRequestProperty("Cookie", "SESSID=" + nitro_util.encode(sessionid));
				httpURLConnection.setRequestProperty("Accept-Encoding", "gzip, deflate");
			}
			
			if (httpURLConnection instanceof HttpsURLConnection)
			{
				SSLContext sslContext = SSLContext.getInstance("SSL");
				//we are using an empty trust manager, because MPS currently presents
				//a test certificate not issued by any signing authority, so we need to bypass
				//the credentials check
				sslContext.init(null, new TrustManager[]{new EmptyTrustManager()}, null);
				SocketFactory sslSocketFactory = sslContext.getSocketFactory();

				HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection;
				secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory);
				secured.setHostnameVerifier(new EmptyHostnameVerifier());
			}

			InputStream input = httpURLConnection.getInputStream();
			String contentEncoding = httpURLConnection.getContentEncoding();
			//	get correct input stream for compressed data:
			if (contentEncoding != null)
			{
				if(contentEncoding.equalsIgnoreCase("gzip"))
					input = new GZIPInputStream(input); //reads 2 bytes to determine GZIP stream!
				else if(contentEncoding.equalsIgnoreCase("deflate"))
					input = new InflaterInputStream(input);
			}

			int numOfTotalBytesRead;
			byte [] buffer = new byte[1024];
			while ((numOfTotalBytesRead = input.read(buffer, 0, buffer.length)) != -1)
			{
				responseStr.append(new String(buffer, 0, numOfTotalBytesRead));
			}

			httpURLConnection.disconnect();
			input.close();
		}
		catch (MalformedURLException mue)
		{
			System.err.println("Invalid URL");
		}
		catch (IOException ioe)
		{
			System.err.println("I/O Error - " + ioe);
		}
		catch(Exception e)
		{
			System.err.println("Error - " + e);
		}		
		
		return responseStr.toString();	
	}