Create new External Gateway

        :param str name: name of test_external gateway
        :param bool trust_all_cas: whether to trust all internal CA's
               (default: True)
        :return: instance with meta
        :rtype: ExternalGateway
488870
def create(cls, name, trust_all_cas=True):
        
        json = {'name': name,
                'trust_all_cas': trust_all_cas}

        return ElementCreator(cls, json)
64275
function createUser(name, pass, cb) {
  // Check name
  if(!isValidName(name)) return cb(new Error('Invalid name "'+name+'"'))
  // Check pass
  if(!isValidPass(pass)) return cb(new Error('Invalid pass: "'+pass+'"'))
  // gen salt
  var salt = crypto.randomBytes(16).toString('hex')
  // gen sha1
  var hash = crypto.createHash('sha1')
  hash.update(pass)
  hash.update(salt)
  var password_sha = hash.digest('hex')
  
  var new_doc =
      { _id: user_namespace+':'+name
      , name: name
      , roles: []
      , type: 'user'
      , password_sha: password_sha
      , salt: salt
      }
    ;
  
  nano().use(user_dbname).insert(new_doc, function(err, doc, h) {
    if(err) return cb(err)
    
    // Every user gets its own database
    createDatabase(name, function(err) {
      if(err) return cb(err)
      
      // Sets the _security
      setDatabaseSecurity(name, function(err) {
        if(err) return cb(err)
        cb(null, doc.id, doc.rev)
      })
    })
  })
}
699281
def create(cls, interface_id, logical_interface_ref,
            second_interface_id=None, zone_ref=None, **kwargs):
        
        data = {'inspect_unspecified_vlans': True,
                'nicid': '{}-{}'.format(str(interface_id), str(second_interface_id)) if 
                    second_interface_id else str(interface_id),
                'logical_interface_ref': logical_interface_ref,
                'zone_ref': zone_ref}

        for k, v in kwargs.items():
            data.update({k: v})

        return cls(data)
553905
def client_create(self, name, password):
        
        body = {
            "name": name,
            "password": password
        }
        response = self._post(url.clients, body=body)
        self._check_response(response, 201)
        return self._create_response(response).get("client_id")
152454
def has_external_dependency(name):
    ''
    for directory in os.environ['PATH'].split(':'):
        if os.path.exists(os.path.join(directory, name)):
            return True
    return False
582729
def Create(self, name):
    
    precondition.AssertType(name, Text)

    try:
      constructor = self._constructors[name]
    except KeyError:
      message = "No constructor for name '%s' has been registered"
      message %= name
      raise ValueError(message)

    instance = constructor()
    if not isinstance(instance, self._cls):
      message = ("Constructor %r for name '%s' returned instance of type %r "
                 "(expected %r)")
      message %= (constructor, name, type(instance), self._cls)
      raise TypeError(message)

    return instance
868448
def check_external_aliases(subname, params, comment, test=nil)
      @@external_aliases.each{ |alias_item|
        if subname == alias_item["old_name"] ||
                    subname.upcase == alias_item["old_name"].upcase &&
                            @options.ignore_case

          new_meth = initialize_external_method(alias_item["new_name"], 
                                                subname, params, @file_name, 
                                                comment)
          new_meth.visibility = alias_item["visibility"]

          progress "e"
          @stats.num_methods += 1
          alias_item["file_or_module"].add_method(new_meth)

          if !alias_item["file_or_module"].include_requires?(@file_name, @options.ignore_case)
            alias_item["file_or_module"].add_require(Require.new(@file_name, ""))
          end
        end
      }
    end
812650
private static void trustAllHosts() {
        // Create a trust manager that does not validate certificate chains
        TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
            @Override
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return new java.security.cert.X509Certificate[] {};
            }

            @Override
            public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
            }

            @Override
            public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
            }
        } };

        // Install the all-trusting trust manager
        try {
            SSLContext sc = SSLContext.getInstance("TLS");
            sc.init(null, trustAllCerts, new java.security.SecureRandom());
            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
666075
def nic_add(self, bridge, nic):
        

        args = {
            'name': bridge,
            'nic': nic,
        }

        self._nic_add_chk.check(args)

        return self._client.json('bridge.nic-add', args)
1101672
def createClientCertificate(self, name, noPass = True, keyLength = 2048, days = 375):
        
        if not name:
            raise ValueError('Require name')
        configPath, keyPath, csrPath, certPath = \
                os.path.join(self.basePath, self.FILE_CONFIG), \
                os.path.join(self.basePath, self.DIR_PRIVATE, '%s.key.pem' % name), \
                os.path.join(self.basePath, self.DIR_CSR, '%s.csr.pem' % name), \
                os.path.join(self.basePath, self.DIR_CERTS, '%s.cert.pem' % name)
        if os.path.isfile(keyPath):
            raise ValueError('Key file exists at [%s]' % keyPath)
        if os.path.isfile(csrPath):
            raise ValueError('CSR file exists at [%s]' % csrPath)
        if os.path.isfile(certPath):
            raise ValueError('Certificate file exists at [%s]' % certPath)
        # Generate the key
        if subprocess.call([ 'openssl', 'genrsa', '-aes256', '-out', keyPath, str(keyLength) ] if not noPass else [ 'openssl', 'genrsa', '-out', keyPath, str(keyLength) ]) != 0:
            raise ValueError('Failed to create key')
        # Generate the csr
        if subprocess.call([ 'openssl', 'req', '-config', configPath, '-key', keyPath, '-new', '-sha256', '-out', csrPath ]) != 0:
            raise ValueError('Failed to create CSR')
        # Generate the certificate
        if subprocess.call([ 'openssl', 'ca', '-config', configPath, '-extensions', 'usr_cert', '-days', str(days), '-notext', '-md', 'sha256', '-in', csrPath, '-out', certPath ]) != 0:
            raise ValueError('Failed to create certificate')
1228950
def _build_client(self, name=None):
        
        url_path = self._url_path + [name] if name else self._url_path
        return Client(host=self.host,
                      version=self._version,
                      request_headers=self.request_headers,
                      url_path=url_path,
                      append_slash=self.append_slash,
                      timeout=self.timeout)
293081
def create_securitygroup(self, name=None, description=None):
        

        create_dict = {'name': name, 'description': description}
        return self.security_group.createObject(create_dict)
435832
def create_session(self, ticket, payload=None, expires=None):
        '''
        
        '''
        assert isinstance(self.session_storage_adapter, CASSessionAdapter)
        logging.debug('[CAS] Creating session for ticket {}'.format(ticket))
        self.session_storage_adapter.create(
            ticket,
            payload=payload,
            expires=expires,
            )
1214523
def authenticate_external(self, auth_params):
        
        if not isinstance(auth_params, list):
            raise TypeError("auth_params can only be an instance of type list")
        for a in auth_params[:10]:
            if not isinstance(a, basestring):
                raise TypeError(
                        "array can only contain objects of type basestring")
        result = self._call("authenticateExternal",
                     in_p=[auth_params])
        return result
704123
def create_keypair(self, keypair_name):
        
        query = self.query_factory(
            action="CreateKeyPair", creds=self.creds, endpoint=self.endpoint,
            other_params={"KeyName": keypair_name})
        d = query.submit()
        return d.addCallback(self.parser.create_keypair)
130839
def create_protocol(name, **kwargs):
    
    cls = protocol_map.get(name)
    if not cls:
        raise ValueError('Unsupported protocol "%s".' % name)
    return cls(**kwargs)
1283147
def create(name: str, *,
           validate: bool=None) -> snug.Query[Channel]:
    """"""
    return {'name': name, 'validate': validate}