Creates a new IPsecPolicy
776305
def create_ipsecpolicy(self, name, **kwargs):
        '''
        
        '''
        body = {'name': name}
        if 'transform_protocol' in kwargs:
            body['transform_protocol'] = kwargs['transform_protocol']
        if 'auth_algorithm' in kwargs:
            body['auth_algorithm'] = kwargs['auth_algorithm']
        if 'encapsulation_mode' in kwargs:
            body['encapsulation_mode'] = kwargs['encapsulation_mode']
        if 'encryption_algorithm' in kwargs:
            body['encryption_algorithm'] = kwargs['encryption_algorithm']
        if 'pfs' in kwargs:
            body['pfs'] = kwargs['pfs']
        if 'units' in kwargs:
            body['lifetime'] = {'units': kwargs['units']}
        if 'value' in kwargs:
            if 'lifetime' not in body:
                body['lifetime'] = {}
            body['lifetime']['value'] = kwargs['value']
        return self.network_conn.create_ipsecpolicy(body={'ipsecpolicy': body})
485477
def create(self, name, plugin_name, plugin_version, flavor_id,
               description=None, volumes_per_node=None, volumes_size=None,
               node_processes=None, node_configs=None, floating_ip_pool=None,
               security_groups=None, auto_security_group=None,
               availability_zone=None, volumes_availability_zone=None,
               volume_type=None, image_id=None, is_proxy_gateway=None,
               volume_local_to_instance=None, use_autoconfig=None,
               shares=None, is_public=None, is_protected=None,
               volume_mount_prefix=None, boot_from_volume=None,
               boot_volume_type=None, boot_volume_availability_zone=None,
               boot_volume_local_to_instance=None):
        """"""

        data = {
            'name': name,
            'plugin_name': plugin_name,
            'plugin_version': plugin_version,
            'flavor_id': flavor_id,
            'node_processes': node_processes
        }

        return self._do_create(data, description, volumes_per_node,
                               volumes_size, node_configs, floating_ip_pool,
                               security_groups, auto_security_group,
                               availability_zone, volumes_availability_zone,
                               volume_type, image_id, is_proxy_gateway,
                               volume_local_to_instance, use_autoconfig,
                               shares, is_public, is_protected,
                               volume_mount_prefix, boot_from_volume,
                               boot_volume_type,
                               boot_volume_availability_zone,
                               boot_volume_local_to_instance)
147184
def create(self, ipv6s):
        

        data = {'ips': ipv6s}
        return super(ApiV4IPv6, self).post('api/v4/ipv6/', data)
1172739
def create(cls, ip_version, datacenter, bandwidth, vm=None, vlan=None,
               ip=None, background=False):
        
        return Iface.create(ip_version, datacenter, bandwidth, vlan, vm, ip,
                            background)
212483
public static base_responses add(nitro_service client, ipsecprofile resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			ipsecprofile addresources[] = new ipsecprofile[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new ipsecprofile();
				addresources[i].name = resources[i].name;
				addresources[i].ikeversion = resources[i].ikeversion;
				addresources[i].encalgo = resources[i].encalgo;
				addresources[i].hashalgo = resources[i].hashalgo;
				addresources[i].lifetime = resources[i].lifetime;
				addresources[i].psk = resources[i].psk;
				addresources[i].publickey = resources[i].publickey;
				addresources[i].privatekey = resources[i].privatekey;
				addresources[i].peerpublickey = resources[i].peerpublickey;
				addresources[i].livenesscheckinterval = resources[i].livenesscheckinterval;
				addresources[i].replaywindowsize = resources[i].replaywindowsize;
				addresources[i].ikeretryinterval = resources[i].ikeretryinterval;
				addresources[i].retransmissiontime = resources[i].retransmissiontime;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}
109983
def new(
    name,
    bucket,
    timeout,
    memory,
    description,
    subnet_ids,
    security_group_ids
):
    
    config = {}
    if timeout:
        config['timeout'] = timeout
    if memory:
        config['memory'] = memory
    if description:
        config['description'] = description
    if subnet_ids:
        config['subnet_ids'] = subnet_ids
    if security_group_ids:
        config['security_group_ids'] = security_group_ids

    lambder.create_project(name, bucket, config)
308016
def create(cls, fqdn, flags, algorithm, public_key):
        """"""
        fqdn = fqdn.lower()

        params = {
            'flags': flags,
            'algorithm': algorithm,
            'public_key': public_key,
        }

        result = cls.call('domain.dnssec.create', fqdn, params)

        return result
1280711
def createRootCertificate(self, noPass = False, keyLength = 4096):
        
        configPath, keyPath, certPath = \
                os.path.join(self.basePath, self.FILE_CONFIG), \
                os.path.join(self.basePath, self.DIR_PRIVATE, self.FILE_CA_KEY), \
                os.path.join(self.basePath, self.DIR_CERTS, self.FILE_CA_CERT)
        if os.path.isfile(keyPath):
            raise ValueError('CA key file exists at [%s]' % keyPath)
        if os.path.isfile(certPath):
            raise ValueError('CA 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 root key')
        # Generate the cert
        if subprocess.call([ 'openssl', 'req', '-config', configPath, '-key', keyPath, '-new', '-x509', '-days', '7300', '-sha256', '-extensions', 'v3_ca', '-out', certPath ]) != 0:
            raise ValueError('Failed to create root certifcate')
721822
def create_port_forwarding_rule(ip_address_id, private_port, protocol, public_port, virtual_machine_id)
      params = {
          'command' => 'createPortForwardingRule',
          'ipAddressId' => ip_address_id,
          'privatePort' => private_port,
          'protocol' => protocol,
          'publicPort' => public_port,
          'virtualMachineId' => virtual_machine_id
      }
      json = send_async_request(params)
      json['portforwardingrule']
    end
22892
def create(cls, ip_version, datacenter, bandwidth, vlan, vm, ip,
               background):
        
        if not background and not cls.intty():
            background = True

        datacenter_id_ = int(Datacenter.usable_id(datacenter))

        iface_params = {
            'ip_version': ip_version,
            'datacenter_id': datacenter_id_,
            'bandwidth': bandwidth,
        }
        if vlan:
            iface_params['vlan'] = Vlan.usable_id(vlan)
            if ip:
                iface_params['ip'] = ip

        result = cls.call('hosting.iface.create', iface_params)

        if background and not vm:
            return result

        # interactive mode, run a progress bar
        cls.echo('Creating your iface.')
        cls.display_progress(result)
        iface_info = cls._info(result['iface_id'])
        cls.echo('Your iface has been created with the following IP '
                 'addresses:')
        for _ip in iface_info['ips']:
            cls.echo('ip%d:\t%s' % (_ip['version'], _ip['ip']))

        if not vm:
            return result

        vm_id = Iaas.usable_id(vm)
        result = cls._attach(result['iface_id'], vm_id)

        if background:
            return result

        cls.echo('Attaching your iface.')
        cls.display_progress(result)
        return result
550288
def create(self, networkipv4s):
        

        data = {'networks': networkipv4s}
        return super(ApiNetworkIPv4, self).post('api/v3/networkv4/', data)
283139
public static base_response add(nitro_service client, ipsecprofile resource) throws Exception {
		ipsecprofile addresource = new ipsecprofile();
		addresource.name = resource.name;
		addresource.ikeversion = resource.ikeversion;
		addresource.encalgo = resource.encalgo;
		addresource.hashalgo = resource.hashalgo;
		addresource.lifetime = resource.lifetime;
		addresource.psk = resource.psk;
		addresource.publickey = resource.publickey;
		addresource.privatekey = resource.privatekey;
		addresource.peerpublickey = resource.peerpublickey;
		addresource.livenesscheckinterval = resource.livenesscheckinterval;
		addresource.replaywindowsize = resource.replaywindowsize;
		addresource.ikeretryinterval = resource.ikeretryinterval;
		addresource.retransmissiontime = resource.retransmissiontime;
		return addresource.add_resource(client);
	}
155860
def create(vm_):
    '''
    
    '''
    if 'driver' not in vm_:
        vm_['driver'] = vm_['provider']

    private_networking = config.get_cloud_config_value(
        'enable_private_network', vm_, __opts__, search_global=False, default=False,
    )

    startup_script = config.get_cloud_config_value(
        'startup_script_id', vm_, __opts__, search_global=False, default=None,
    )

    if startup_script and str(startup_script) not in avail_scripts():
        log.error('Your Vultr account does not have a startup script with ID %s', str(startup_script))
        return False

    if private_networking is not None:
        if not isinstance(private_networking, bool):
            raise SaltCloudConfigError("'private_networking' should be a boolean value.")
    if private_networking is True:
        enable_private_network = 'yes'
    else:
        enable_private_network = 'no'

    __utils__['cloud.fire_event'](
        'event',
        'starting create',
        'salt/cloud/{0}/creating'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    osid = _lookup_vultrid(vm_['image'], 'avail_images', 'OSID')
    if not osid:
        log.error('Vultr does not have an image with id or name %s', vm_['image'])
        return False

    vpsplanid = _lookup_vultrid(vm_['size'], 'avail_sizes', 'VPSPLANID')
    if not vpsplanid:
        log.error('Vultr does not have a size with id or name %s', vm_['size'])
        return False

    dcid = _lookup_vultrid(vm_['location'], 'avail_locations', 'DCID')
    if not dcid:
        log.error('Vultr does not have a location with id or name %s', vm_['location'])
        return False

    kwargs = {
        'label': vm_['name'],
        'OSID': osid,
        'VPSPLANID': vpsplanid,
        'DCID': dcid,
        'hostname': vm_['name'],
        'enable_private_network': enable_private_network,
    }
    if startup_script:
        kwargs['SCRIPTID'] = startup_script

    log.info('Creating Cloud VM %s', vm_['name'])

    __utils__['cloud.fire_event'](
        'event',
        'requesting instance',
        'salt/cloud/{0}/requesting'.format(vm_['name']),
        args={
            'kwargs': __utils__['cloud.filter_event']('requesting', kwargs, list(kwargs)),
        },
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport'],
    )

    try:
        data = _query('server/create', method='POST', data=_urlencode(kwargs))
        if int(data.get('status', '200')) >= 300:
            log.error(
                'Error creating %s on Vultr\n\n'
                'Vultr API returned %s\n', vm_['name'], data
            )
            log.error('Status 412 may mean that you are requesting an\n'
                      'invalid location, image, or size.')

            __utils__['cloud.fire_event'](
                'event',
                'instance request failed',
                'salt/cloud/{0}/requesting/failed'.format(vm_['name']),
                args={'kwargs': kwargs},
                sock_dir=__opts__['sock_dir'],
                transport=__opts__['transport'],
            )
            return False
    except Exception as exc:
        log.error(
            'Error creating %s on Vultr\n\n'
            'The following exception was thrown when trying to '
            'run the initial deployment:\n%s',
            vm_['name'], exc,
            # Show the traceback if the debug logging level is enabled
            exc_info_on_loglevel=logging.DEBUG
        )
        __utils__['cloud.fire_event'](
            'event',
            'instance request failed',
            'salt/cloud/{0}/requesting/failed'.format(vm_['name']),
            args={'kwargs': kwargs},
            sock_dir=__opts__['sock_dir'],
            transport=__opts__['transport'],
        )
        return False

    def wait_for_hostname():
        '''
        Wait for the IP address to become available
        '''
        data = show_instance(vm_['name'], call='action')
        main_ip = six.text_type(data.get('main_ip', '0'))
        if main_ip.startswith('0'):
            time.sleep(3)
            return False
        return data['main_ip']

    def wait_for_default_password():
        '''
        Wait for the IP address to become available
        '''
        data = show_instance(vm_['name'], call='action')
        # print("Waiting for default password")
        # pprint.pprint(data)
        if six.text_type(data.get('default_password', '')) == '':
            time.sleep(1)
            return False
        return data['default_password']

    def wait_for_status():
        '''
        Wait for the IP address to become available
        '''
        data = show_instance(vm_['name'], call='action')
        # print("Waiting for status normal")
        # pprint.pprint(data)
        if six.text_type(data.get('status', '')) != 'active':
            time.sleep(1)
            return False
        return data['default_password']

    def wait_for_server_state():
        '''
        Wait for the IP address to become available
        '''
        data = show_instance(vm_['name'], call='action')
        # print("Waiting for server state ok")
        # pprint.pprint(data)
        if six.text_type(data.get('server_state', '')) != 'ok':
            time.sleep(1)
            return False
        return data['default_password']

    vm_['ssh_host'] = __utils__['cloud.wait_for_fun'](
        wait_for_hostname,
        timeout=config.get_cloud_config_value(
            'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
    )
    vm_['password'] = __utils__['cloud.wait_for_fun'](
        wait_for_default_password,
        timeout=config.get_cloud_config_value(
            'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
    )
    __utils__['cloud.wait_for_fun'](
        wait_for_status,
        timeout=config.get_cloud_config_value(
            'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
    )
    __utils__['cloud.wait_for_fun'](
        wait_for_server_state,
        timeout=config.get_cloud_config_value(
            'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
    )

    __opts__['hard_timeout'] = config.get_cloud_config_value(
        'hard_timeout',
        get_configured_provider(),
        __opts__,
        search_global=False,
        default=None,
    )

    # Bootstrap
    ret = __utils__['cloud.bootstrap'](vm_, __opts__)

    ret.update(show_instance(vm_['name'], call='action'))

    log.info('Created Cloud VM \'%s\'', vm_['name'])
    log.debug(
        '\'%s\' VM creation details:\n%s',
        vm_['name'], pprint.pformat(data)
    )

    __utils__['cloud.fire_event'](
        'event',
        'created instance',
        'salt/cloud/{0}/created'.format(vm_['name']),
        args=__utils__['cloud.filter_event']('created', vm_, ['name', 'profile', 'provider', 'driver']),
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    return ret
387881
function create(server, fn) {
  var type = is(server)
    , options;

  if ('object' === type) options = server;
  else if ('number' === type) options = { port: server };
  else options = {};

  fn = create.fns(fn || options);

  var certs = options.key && options.cert       // Check HTTPS certs.
    , hostname = options.hostname               // Bind address.
    , port = options.port || 443                // Force HTTPS by default.
    , secure = certs || 443 === port            // Check for true HTTPS.
    , spdy = 'spdy' in options;                 // Or are we spdy.

  //
  // Determine which type of server we need to create.
  //
  if (spdy) type = 'spdy';
  else if (secure) type = 'https';
  else type = 'http';

  //
  // We need to have SSL certs for SPDY and secure servers.
  //
  if ((secure || spdy) && !certs) {
    throw new Error('Missing the SSL key or certificate files in the options.');
  }

  //
  // When given a `options.root` assume that our SSL certs and keys are path
  // references that still needs to be read. This allows a much more human
  // readable interface for SSL.
  //
  if (secure && options.root) {
    ['cert', 'key', 'ca', 'pfx', 'crl'].filter(function filter(key) {
      return key in options;
    }).forEach(function parse(key) {
      var data = options[key];

      if (Array.isArray(data)) {
        options[key] = data.map(function read(file) {
          return fs.readFileSync(path.join(options.root, file));
        });
      } else {
        options[key] = fs.readFileSync(path.join(options.root, data));
      }
    });
  }

  //
  // Provide additional protection for HTTPS server by supplying a safer cypher
  // set and prevent POODLE attacks on the servers.
  //
  if (secure) {
    //
    // Protection against POODLE attacks.
    //
    options.secureProtocol = options.secureProtocol || 'SSLv23_method';
    options.secureOptions = options.secureOptions || require('constants').SSL_OP_NO_SSLv3;

    //
    // Optimized cipher list.
    //
    options.ciphers = options.ciphers || [
      'ECDHE-RSA-AES256-SHA384',
      'DHE-RSA-AES256-SHA384',
      'ECDHE-RSA-AES256-SHA256',
      'DHE-RSA-AES256-SHA256',
      'ECDHE-RSA-AES128-SHA256',
      'DHE-RSA-AES128-SHA256',
      'HIGH',
      '!aNULL',
      '!eNULL',
      '!EXPORT',
      '!DES',
      '!RC4',
      '!MD5',
      '!PSK',
      '!SRP',
      '!CAMELLIA'
    ].join(':');
  }

  //
  // Create the correct server instance and pass in the options object for those
  // who require it (spoiler: all non http servers).
  //
  server = require(type).createServer('http' !== type ? options : undefined);

  //
  // Setup an addition redirect server which redirects people to the correct
  // HTTP or HTTPS server.
  //
  if (+options.redirect) {
    var redirect = require('http').createServer(function handle(req, res) {
      res.statusCode = 404;

      if (req.headers.host) {
        var url = parse('http://'+ req.headers.host);

        res.statusCode = 301;
        res.setHeader(
          'Location',
          'http'+ (secure ? 's' : '') +'://'+ url.hostname +':'+ port + req.url
        );
      }

      if (secure) res.setHeader(
        'Strict-Transport-Security',
        'max-age=8640000; includeSubDomains'
      );

      res.end('');
    }).listen(+options.redirect, hostname);

    //
    // Close the redirect server when the main server is closed.
    //
    server.once('close', function close() {
      try { redirect.close(); }
      catch (e) {}
    });
  }

  //
  // Assign the last callbacks.
  //
  if (fn.close) server.once('close', fn.close);
  ['request', 'upgrade', 'error'].forEach(function each(event) {
    if (fn[event]) server.on(event, fn[event]);
  });

  //
  // Things are completed, call callback.
  //
  if (fn[type]) fn[type]();

  if (options.listen !== false) {
    listen(server, port, hostname, fn.listening);
  } else if (fn.listening) {
    server.once('listening', fn.listening);
  }

  return server;
}
1219739
def create(name, allocated_storage, db_instance_class, engine,
           master_username, master_user_password, db_name=None,
           db_security_groups=None, vpc_security_group_ids=None,
           vpc_security_groups=None, availability_zone=None,
           db_subnet_group_name=None, preferred_maintenance_window=None,
           db_parameter_group_name=None, backup_retention_period=None,
           preferred_backup_window=None, port=None, multi_az=None,
           engine_version=None, auto_minor_version_upgrade=None,
           license_model=None, iops=None, option_group_name=None,
           character_set_name=None, publicly_accessible=None, wait_status=None,
           tags=None, db_cluster_identifier=None, storage_type=None,
           tde_credential_arn=None, tde_credential_password=None,
           storage_encrypted=None, kms_key_id=None, domain=None,
           copy_tags_to_snapshot=None, monitoring_interval=None,
           monitoring_role_arn=None, domain_iam_role_name=None, region=None,
           promotion_tier=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    if not allocated_storage:
        raise SaltInvocationError('allocated_storage is required')
    if not db_instance_class:
        raise SaltInvocationError('db_instance_class is required')
    if not engine:
        raise SaltInvocationError('engine is required')
    if not master_username:
        raise SaltInvocationError('master_username is required')
    if not master_user_password:
        raise SaltInvocationError('master_user_password is required')
    if availability_zone and multi_az:
        raise SaltInvocationError('availability_zone and multi_az are mutually'
                                  ' exclusive arguments.')
    if wait_status:
        wait_stati = ['available', 'modifying', 'backing-up']
        if wait_status not in wait_stati:
            raise SaltInvocationError(
                'wait_status can be one of: {0}'.format(wait_stati))
    if vpc_security_groups:
        v_tmp = __salt__['boto_secgroup.convert_to_group_ids'](
                groups=vpc_security_groups, region=region, key=key, keyid=keyid,
                profile=profile)
        vpc_security_group_ids = (vpc_security_group_ids + v_tmp
                                  if vpc_security_group_ids else v_tmp)

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        if not conn:
            return {'results': bool(conn)}

        kwargs = {}
        boto_params = set(boto3_param_map.keys())
        keys = set(locals().keys())
        tags = _tag_doc(tags)

        for param_key in keys.intersection(boto_params):
            val = locals()[param_key]
            if val is not None:
                mapped = boto3_param_map[param_key]
                kwargs[mapped[0]] = mapped[1](val)

        # Validation doesn't want parameters that are None
        # https://github.com/boto/boto3/issues/400
        kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v is not None)

        rds = conn.create_db_instance(**kwargs)

        if not rds:
            return {'created': False}
        if not wait_status:
            return {'created': True, 'message':
                    'RDS instance {0} created.'.format(name)}

        while True:
            jmespath = 'DBInstances[*].DBInstanceStatus'
            status = describe_db_instances(name=name, jmespath=jmespath,
                                           region=region, key=key, keyid=keyid,
                                           profile=profile)
            if status:
                stat = status[0]
            else:
                # Whoops, something is horribly wrong...
                return {'created': False,
                        'error': "RDS instance {0} should have been created but"
                                 " now I can't find it.".format(name)}
            if stat == wait_status:
                return {'created': True,
                        'message': 'RDS instance {0} created (current status '
                        '{1})'.format(name, stat)}
            time.sleep(10)
            log.info('Instance status after 10 seconds is: %s', stat)

    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
344354
public function createNonce($ip_address = '127.0.0.1')
    {
        // Make a nonce
        $this->snonce = new Nonce();
        $snonce       = $this->snonce->getNonce();
        $this->recordServerNonce($snonce, $ip_address);

        return $snonce;
    }
160022
def create_api_ipv4(self):
        """"""

        return ApiIPv4(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)