Create an instance of the appropriate subclass of RaidNode
489053
public static RaidNode createRaidNode(Configuration conf)
      throws ClassNotFoundException {
    try {
      // default to distributed raid node
      Class<?> raidNodeClass =
          conf.getClass(RAIDNODE_CLASSNAME_KEY, DistRaidNode.class);
      if (!RaidNode.class.isAssignableFrom(raidNodeClass)) {
        throw new ClassNotFoundException("not an implementation of RaidNode");
      }
      Constructor<?> constructor =
          raidNodeClass.getConstructor(new Class[] {Configuration.class} );
      return (RaidNode) constructor.newInstance(conf);
    } catch (NoSuchMethodException e) {
      throw new ClassNotFoundException("cannot construct raidnode", e);
    } catch (InstantiationException e) {
      throw new ClassNotFoundException("cannot construct raidnode", e);
    } catch (IllegalAccessException e) {
      throw new ClassNotFoundException("cannot construct raidnode", e);
    } catch (InvocationTargetException e) {
      throw new ClassNotFoundException("cannot construct raidnode", e);
    }
  }
262678
def create(cls, path):
        """"""
        cmd = [HG, 'init', path]
        subprocess.check_call(cmd)
        return cls(path)
450006
function spawnNode(endpoint, seeds, cb) {
    MockRpc.spawn(endpoint, function (err, rpc) {
        if (err) return cb(err);
        Dht.spawn(rpc, seeds, function (err, dht) {
            if (err) return cb(err);
            cb(err, dht);
        });
    });
}
857279
def Instance(reactor=None):
        
        if NodeLeader._LEAD is None:
            NodeLeader._LEAD = NodeLeader(reactor)
        return NodeLeader._LEAD
1324151
def _subclass(self, parser):
        '''
         
        '''
        _set(self, '_sub', parser._create(memoryview(getattr(self, '_extra', b'')), self._target))
        try:
            object.__delattr__(self, '_extra')
        except:
            pass
75937
def duplicate_pvd(self):
        # type: () -> None
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInvalidInput('This object is not yet initialized; call either open() or new() to create an ISO')

        pvd = headervd.PrimaryOrSupplementaryVD(headervd.VOLUME_DESCRIPTOR_TYPE_PRIMARY)
        pvd.copy(self.pvd)
        self.pvds.append(pvd)

        self._finish_add(self.pvd.logical_block_size(), 0)
546500
def create_raid_configuration(irmc_info, target_raid_config):
    

    if len(target_raid_config['logical_disks']) < 1:
        raise ELCMValueError(message="logical_disks must not be empty")

    # Check RAID config in the new RAID adapter. Must be erased before
    # create new RAID config.
    raid_adapter = get_raid_adapter(irmc_info)
    logical_drives = raid_adapter['Server']['HWConfigurationIrmc'][
        'Adapters']['RAIDAdapter'][0].get('LogicalDrives')
    session_timeout = irmc_info.get('irmc_raid_session_timeout',
                                    RAID_CONFIG_SESSION_TIMEOUT)
    if logical_drives is not None:
        # Delete exist logical drives in server.
        # NOTE(trungnv): Wait session complete and raise error if
        # delete raid config during FGI(Foreground Initialization) in-progress
        # in previous mechanism.
        delete_raid_configuration(irmc_info)
        # Updating raid adapter profile after deleted profile.
        raid_adapter = get_raid_adapter(irmc_info)

    # Create raid configuration based on target_raid_config of node
    raid_input = _update_raid_input_data(target_raid_config, raid_adapter)
    session = elcm_profile_set(irmc_info, raid_input)
    # Monitoring raid creation session until done.
    _process_session_data(irmc_info, 'CONFIG_RAID',
                          session['Session']['Id'],
                          session_timeout)
743829
def create(self):
        
        logger.info("creating server")
        self.library.Srv_Create.restype = snap7.snap7types.S7Object
        self.pointer = snap7.snap7types.S7Object(self.library.Srv_Create())
869690
def show_instance(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The show_instance action must be called with -a or --action.'
        )
    node = _get_node(name)
    __utils__['cloud.cache_node'](node, __active_provider_name__, __opts__)
    return node
631333
def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None):
        

        if cls.class_instance is None:
            if hostname is None and auth is None and protocol is None and port is None and database is None:
                cls.class_instance = Client(hostname='localhost')
            else:
                cls.class_instance = Client(hostname=hostname, auth=auth, protocol=protocol, port=port, database=database)
        else:
            if hostname is not None:
                cls.class_instance.hostname = hostname

            if protocol is not None:
                cls.class_instance.hostname = protocol

            if port is not None:
                cls.class_instance.hostname = port

            if database is not None:
                cls.class_instance.database = database

            if auth is not None:
                cls.class_instance.auth = auth

            cls.class_instance._create_api()

        return cls.class_instance
243934
def _generate_instances(self):
        
        for node in self.node_stack:
            yield node
        while self._data:
            yield self._make_instance(self._data.pop(0))
831810
def make_server(
        server_class, handler_class, authorizer_class, filesystem_class,
        host_port, file_access_user=None, **handler_options):
    
    from . import compat
    if isinstance(handler_class, compat.string_type):
        handler_class = import_class(handler_class)

    if isinstance(authorizer_class, compat.string_type):
        authorizer_class = import_class(authorizer_class)

    if isinstance(filesystem_class, compat.string_type):
        filesystem_class = import_class(filesystem_class)

    authorizer = authorizer_class(file_access_user)
    handler = handler_class
    for key, value in handler_options.items():
        setattr(handler, key, value)
    handler.authorizer = authorizer
    if filesystem_class is not None:
        handler.abstracted_fs = filesystem_class
    return server_class(host_port, handler)
212984
public function build(): RequestNodeRequest
	{
		$instance = new RequestNodeRequest();
		if ($this->objectId === null) {
			throw new BuilderException('Property [objectId] is required.');
		}
		$instance->objectId = $this->objectId;
		return $instance;
	}
41092
def create_bulk(cls, name, interfaces=None, nodes=2, cluster_mode='balancing',
            primary_mgt=None, backup_mgt=None, primary_heartbeat=None,
            log_server_ref=None, domain_server_address=None, location_ref=None,
            default_nat=False, enable_antivirus=False, enable_gti=False, comment=None,
            snmp=None, **kw):
        
        primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat
        
        physical_interfaces = []
        for interface in interfaces:
            if 'interface_id' not in interface:
                raise CreateEngineFailed('Interface definitions must contain the interface_id '
                    'field. Failed to create engine: %s' % name)
            if interface.get('type', None) == 'tunnel_interface':
                tunnel_interface = TunnelInterface(**interface)
                physical_interfaces.append(
                    {'tunnel_interface': tunnel_interface})
            else:
                cluster_interface = ClusterPhysicalInterface(
                    primary_mgt=primary_mgt, backup_mgt=backup_mgt,
                    primary_heartbeat=primary_heartbeat, **interface)
                physical_interfaces.append(
                    {'physical_interface': cluster_interface})

        if snmp:
            snmp_agent = dict(
                snmp_agent_ref=snmp.get('snmp_agent', ''),
                snmp_location=snmp.get('snmp_location', ''))
            
            snmp_agent.update(
                snmp_interface=add_snmp(
                    interfaces,
                    snmp.get('snmp_interface', [])))
    
        try:
            engine = super(FirewallCluster, cls)._create(
                name=name,
                node_type='firewall_node',
                physical_interfaces=physical_interfaces,
                domain_server_address=domain_server_address,
                log_server_ref=log_server_ref,
                location_ref=location_ref,
                nodes=nodes, enable_gti=enable_gti,
                enable_antivirus=enable_antivirus,
                default_nat=default_nat,
                snmp_agent=snmp_agent if snmp else None,
                comment=comment)
            engine.update(cluster_mode=cluster_mode)
            
            return ElementCreator(cls, json=engine)
    
        except (ElementNotFound, CreateElementFailed) as e:
            raise CreateEngineFailed(e)
1041832
private void createMDAGNode(SimpleMDAGNode current, int fromIndex, MDAGNode[] toNodeArray, MDAGNode[] fromNodeArray)
    {
        MDAGNode from = (fromIndex == -1 ? sourceNode : toNodeArray[fromIndex]);
        int transitionSetBegin = current.getTransitionSetBeginIndex();
        int onePastTransitionSetEnd = transitionSetBegin + current.getOutgoingTransitionSetSize();

        for (int i = transitionSetBegin; i < onePastTransitionSetEnd; i++)
        {
            SimpleMDAGNode targetNode = mdagDataArray[i];
            if (toNodeArray[i] != null)
            {
                fromNodeArray[fromIndex].addOutgoingTransition(current.getLetter(), fromNodeArray[i]);
                toNodeArray[fromIndex] = fromNodeArray[i];
                continue;
            }
            toNodeArray[i] = from.addOutgoingTransition(targetNode.getLetter(), targetNode.isAcceptNode());
            fromNodeArray[i] = from;
            createMDAGNode(targetNode, i, toNodeArray, fromNodeArray);
        }
    }
1366855
def create_node(kwargs):
    '''
    
    '''
    if not isinstance(kwargs, dict):
        kwargs = {}

    # Required parameters
    params = {
        'Action': 'CreateInstance',
        'InstanceType': kwargs.get('size_id', ''),
        'RegionId': kwargs.get('region_id', DEFAULT_LOCATION),
        'ImageId': kwargs.get('image_id', ''),
        'SecurityGroupId': kwargs.get('securitygroup_id', ''),
        'InstanceName': kwargs.get('name', ''),
    }

    # Optional parameters'
    optional = [
        'InstanceName', 'InternetChargeType',
        'InternetMaxBandwidthIn', 'InternetMaxBandwidthOut',
        'HostName', 'Password', 'SystemDisk.Category', 'VSwitchId'
        # 'DataDisk.n.Size', 'DataDisk.n.Category', 'DataDisk.n.SnapshotId'
    ]

    for item in optional:
        if item in kwargs:
            params.update({item: kwargs[item]})

    # invoke web call
    result = query(params)
    return result['InstanceId']
944916
private static void setupldapServer() throws Exception {

        ds = new InMemoryLDAPServer(SUB_DN);

        Entry entry = new Entry(SUB_DN);
        entry.addAttribute("objectclass", "top");
        entry.addAttribute("objectclass", "domain");
        ds.add(entry);
        /*
         * Add the partition entries.
         */
        entry = new Entry("ou=Test,o=ibm,c=us");
        entry.addAttribute("objectclass", "organizationalunit");
        entry.addAttribute("ou", "Test");
        ds.add(entry);

        entry = new Entry(USER_BASE_DN);
        entry.addAttribute("objectclass", "organizationalunit");
        entry.addAttribute("ou", "Test");
        entry.addAttribute("ou", "TestUsers");
        ds.add(entry);

        entry = new Entry(BAD_USER_BASE_DN);
        entry.addAttribute("objectclass", "organizationalunit");
        entry.addAttribute("ou", "BadUsers");
        ds.add(entry);

        entry = new Entry("ou=Dev,o=ibm,c=us");
        entry.addAttribute("objectclass", "organizationalunit");
        entry.addAttribute("ou", "Dev");
        ds.add(entry);

        entry = new Entry(GROUP_BASE_DN);
        entry.addAttribute("objectclass", "organizationalunit");
        entry.addAttribute("ou", "Dev");
        entry.addAttribute("ou", "DevGroups");
        ds.add(entry);

        /*
         * Create the user and group.
         */
        entry = new Entry(USER_DN);
        entry.addAttribute("objectclass", "inetorgperson");
        entry.addAttribute("uid", USER);
        entry.addAttribute("sn", USER);
        entry.addAttribute("cn", USER);
        entry.addAttribute("userPassword", "password");
        ds.add(entry);

        entry = new Entry(BAD_USER_DN);
        entry.addAttribute("objectclass", "inetorgperson");
        entry.addAttribute("uid", BAD_USER);
        entry.addAttribute("sn", BAD_USER);
        entry.addAttribute("cn", BAD_USER);
        entry.addAttribute("userPassword", "password");
        ds.add(entry);

        entry = new Entry(GROUP_DN);
        entry.addAttribute("objectclass", "groupofnames");
        entry.addAttribute("cn", GROUP);
        entry.addAttribute("member", USER_DN);
        entry.addAttribute("member", BAD_USER_DN);
        ds.add(entry);
    }