Creates a global IP.
1121
def cli(env, ipv6, test):
    """"""

    mgr = SoftLayer.NetworkManager(env.client)

    version = 4
    if ipv6:
        version = 6

    if not (test or env.skip_confirmations):
        if not formatting.confirm("This action will incur charges on your "
                                  "account. Continue?"):
            raise exceptions.CLIAbort('Cancelling order.')

    result = mgr.add_global_ip(version=version, test_order=test)

    table = formatting.Table(['item', 'cost'])
    table.align['Item'] = 'r'
    table.align['cost'] = 'r'

    total = 0.0
    for price in result['orderDetails']['prices']:
        total += float(price.get('recurringFee', 0.0))
        rate = "%.2f" % float(price['recurringFee'])

        table.add_row([price['item']['description'], rate])

    table.add_row(['Total monthly cost', "%.2f" % total])
    env.fout(table)
261453
def create(gandi, address, destination):
    """"""
    source, domain = address

    result = gandi.forward.create(domain, source, destination)

    return result
253392
def _set_ip(self):
        """"""
        self._ip = socket.gethostbyname(self._fqdn)
        log.debug('IP: %s' % self._ip)
533948
def create(gandi, resource, flags, algorithm, public_key):
    """"""

    result = gandi.dnssec.create(resource, flags, algorithm, public_key)

    return result
1320863
def create(self, ipv6s):
        

        data = {'ips': ipv6s}
        return super(ApiIPv6, self).post('api/v3/ipv6/', data)
875814
public static function createFromGlobals() {
		$request = new static;
		$request->get->setAll($_GET);
		$request->post->setAll($_POST);
		$request->setFiles($_FILES);
		$request->header->setAll(static::getAllHeaders());
		$request->server->setAll($_SERVER);
		$request->cookie->setAll($_COOKIE);
		$request->body = file_get_contents('php://input');

		$server = trim($request->server['SERVER_NAME'], '/');
		if(isset($request->server['SERVER_PORT']) && $request->server['SERVER_PORT'] != '80')
			$server .= ':'.$request->server['SERVER_PORT'];
		if($request->server->has('ORIG_SCRIPT_NAME'))
			$root = dirname($request->server['ORIG_SCRIPT_NAME']);
		else
			$root = dirname($request->server['SCRIPT_NAME']);
		$root = trim($root, '/');

		if($request->header->has('X_ORIGINAL_URL'))
			$url = $request->header['X_ORIGINAL_URL'];
		if($request->header->has('X_REWRITE_URL'))
			$url = $request->header['X_REWRITE_URL'];
		elseif($request->server->has('IIS_WasUrlRewritten'))
			$url = $request->server['IIS_WasUrlRewritten'];
		elseif($request->server->has('REQUEST_URI'))
			$url = $request->server['REQUEST_URI'];
		elseif($request->server->has('ORIG_PATH_INFO'))
			$url = $request->server['ORIG_PATH_INFO'];
		else
			$url = '';
		$url = ltrim($url, '/');
		$parse = parse_url($url);
		if(isset($parse['path']))
			$url = $parse['path'];
		else
			$url = '';
		$root = trim($root, '/');
		$url = preg_replace('/^'.preg_quote($root, '/').'/', '', $url);

		$protocol = $request->server['REQUEST_SCHEME'].'://';

		$request->setURL($server, $root, $url, $protocol);

		return $request;
	}
513616
def allocate_ip_for_subnet(self, subnet_id, mac, port_id):
        """"""
        # Get an available IP and mark it as used before someone else does
        # If there's no IP, , log it and return an error
        # If we successfully get an IP, create a port with the specified MAC and device data
        # If port creation fails, deallocate the IP
        subnet = self.get_subnet(subnet_id)
        ip, mask, port_id = self.a10_allocate_ip_from_dhcp_range(subnet, "vlan", mac, port_id)
        return ip, mask, port_id
993131
private function setIp()
    {
        if (class_exists($Ip = 'Josantonius\Ip\Ip')) {
            $ip = $Ip::get();
            $this->setOption('IP', ($ip) ? $ip : 'unknown');
        }
    }
48682
def convert_to_ip(self):
        """"""
        if not self.is_data_loaded:
            self._import_data()
        if self.is_ip is False:
            for coll in self._data:
                coll.convert_to_ip()
        self._is_ip = True
519062
public static GlobalParameter create(DbConn cnx, String key, String value)
    {
        QueryResult r = cnx.runUpdate("globalprm_insert", key, value);
        GlobalParameter res = new GlobalParameter();
        res.id = r.getGeneratedId();
        res.key = key;
        res.value = value;
        return res;
    }
835939
def add_global_ip(self, version=4, test_order=False):
        
        # This method is here to improve the public interface from a user's
        # perspective since ordering a single global IP through the subnet
        # interface is not intuitive.
        return self.add_subnet('global', version=version,
                               test_order=test_order)
484126
def start(self, listen_ip=LISTEN_IP, listen_port=0):
        """"""
        coro = self.loop.create_datagram_endpoint(
            lambda: self, local_addr=(listen_ip, listen_port))

        self.task = self.loop.create_task(coro)
        return self.task
230557
public static function createFromGlobals()
    {
        $request = new self(@$_SERVER['REQUEST_URI']);
        if (array_key_exists('REQUEST_METHOD', $_SERVER))
        {
            $request->setMethod($_SERVER['REQUEST_METHOD']);
        }
        if ($request->getMethod() == 'POST')
        {
            $request->request->replace($_POST);
        }
        return $request;
    }
378719
public static function createFromGlobals()
    {
        $server = $_SERVER;

        $uriParts = parse_url($server['REQUEST_URI']);

        if(isset($server['HTTP_HOST']))
        {
            list($host, $port) = explode(':', $server['HTTP_HOST']);
            $uriParts['host'] = $host;
            $uriParts['port'] = $port;
        }
        else
        {
            $uriParts['host'] = $server['SERVER_NAME'];
            $uriParts['port'] = $server['SERVER_PORT'];
        }

        $uriParts['scheme'] = isset($server['REQUEST_SCHEME']) ? $server['REQUEST_SCHEME'] : ( isset($server['HTTPS']) && $server['HTTPS'] == 'on' ? 'https' : 'http' );

        $headers = array();

        if(function_exists('getallheaders'))
        {
            // a correct case already
            $apacheHeaders = getallheaders();

            foreach($apacheHeaders as $header => $value)
                $headers[$header] = array_map('trim', explode(',', $value));
        }
        else
        {

            // normalize the header key
            foreach($server as $key => $value)
            {
                if(substr($key, 0, 5) != 'HTTP_')
                    continue;

                $name = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));

                $headers[$name] = array_map('trim', explode(',', $value));
            }
        }

        $request = new static(
            $server['REQUEST_METHOD'],
            new Uri($uriParts),
            $headers,
            Stream::createFromContents(file_get_contents('php://input')),
            $server,
            $_COOKIE,
            UploadedFile::createFromGlobals($_FILES)
        );

        if($server['REQUEST_METHOD'] == 'POST' && in_array($request->getMediaType(), array('application/x-www-form-urlencoded', 'multipart/form-data')))
            $request->setParsedBody($_POST);

        return $request;
    }
195807
def cli(env):
    """"""
    manager = SoftLayer.IPSECManager(env.client)
    contexts = manager.get_tunnel_contexts()

    table = formatting.Table(['id',
                              'name',
                              'friendly name',
                              'internal peer IP address',
                              'remote peer IP address',
                              'created'])
    for context in contexts:
        table.add_row([context.get('id', ''),
                       context.get('name', ''),
                       context.get('friendlyName', ''),
                       context.get('internalPeerIpAddress', ''),
                       context.get('customerPeerIpAddress', ''),
                       context.get('createDate', '')])
    env.fout(table)
1182798
def global_instance(cls, cmdline_args, allow_override=False):
        
        orig_value = cls._instance
        assert (orig_value is None) or allow_override
        new_value = None
        try:
            new_value = CmdlineParser(cmdline_args)
            cls._instance = new_value
            yield new_value
        finally:
            assert cls._instance is new_value
            cls._instance = orig_value
1160861
public static function createServerRequestFromGlobals()
    {
        $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
        $headers = function_exists('getallheaders') ? getallheaders() : [];

        foreach ($headers as $name => $value) {
            unset($headers[$name]);
            $name = str_replace('-', '_', $name);
            $headers[$name] = $value;
        }

        return new static($method, static::createUriFromGlobal($_SERVER), $headers, new PhpInputStream(), $_SERVER);
    }