// CreateSnatPool adds a new snatpool to the BIG-IP system.
555884
func (b *BigIP) CreateSnatPool(name string, members []string) error {
	config := &SnatPool{
		Name:    name,
		Members: members,
	}

	return b.post(config, uriLtm, uriSnatPool)
}
1146870
func (s *Sandbox) NetNsCreate(netNs NetNsIface) error {
	// Create a new netNs if nil provided
	if netNs == nil {
		netNs = &NetNs{}
	}

	// Check if interface is already initialized
	if netNs.Initialized() {
		return fmt.Errorf("net NS already initialized")
	}

	netNs, err := netNs.Initialize()
	if err != nil {
		return err
	}

	if err := netNs.SymlinkCreate(s.name); err != nil {
		logrus.Warnf("Could not create nentns symlink %v", err)

		if err1 := netNs.Close(); err1 != nil {
			return err1
		}

		return err
	}

	s.netns = netNs
	return nil
}
986340
func (ec2i *FakeEC2Impl) CreateSubnet(request *ec2.Subnet) (*ec2.CreateSubnetOutput, error) {
	ec2i.Subnets = append(ec2i.Subnets, request)
	response := &ec2.CreateSubnetOutput{
		Subnet: request,
	}
	return response, nil
}
141125
func NewPool(config *PoolConfig) (*Pool, error) {
	finalConfig := getPoolConfig(config)
	hardwareId, err := getHardwareId()
	if err != nil {
		return nil, err
	}
	return &Pool{
		config:  finalConfig,
		id:      hardwareId,
		wg:      &sync.WaitGroup{},
		exit:    make(chan bool),
		workers: make([]*worker, finalConfig.NumWorkers),
		jobs:    make(chan *Job, finalConfig.BatchSize),
	}, nil
}
425746
func (s *GeoDirectionalPoolsService) Create(k GeoDirectionalPoolKey, val interface{}) (*http.Response, error) {
	return s.client.post(k.URI(), val, nil)
}
278231
func NewPool(opts ...Option) *Pool {
	pool := &Pool{}
	for _, opt := range opts {
		opt(pool)
	}
	return pool
}
995491
func NewPool(ctx context.Context, dialOptions ...grpc.DialOption) *Pool {
	return &Pool{
		bgCtx:       ctx,
		dialOptions: dialOptions,
		conns:       make(map[string]*conn),
	}
}
1375044
func (r Network_LBaaS_L7Pool) CreateL7Pool(loadBalancerUuid *string, l7Pool *datatypes.Network_LBaaS_L7Pool, l7Members []datatypes.Network_LBaaS_L7Member, l7HealthMonitor *datatypes.Network_LBaaS_L7HealthMonitor, l7SessionAffinity *datatypes.Network_LBaaS_L7SessionAffinity) (resp datatypes.Network_LBaaS_LoadBalancer, err error) {
	params := []interface{}{
		loadBalancerUuid,
		l7Pool,
		l7Members,
		l7HealthMonitor,
		l7SessionAffinity,
	}
	err = r.Session.DoRequest("SoftLayer_Network_LBaaS_L7Pool", "createL7Pool", params, &r.Options, &resp)
	return
}
1029882
func (o *PSNATPool) CreatePSPATMap(child *PSPATMap) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
1014387
func (c *Client) CreateNetwork(opts CreateNetworkOptions) (*Network, error) {
	resp, err := c.do(
		"POST",
		"/networks/create",
		doOptions{
			data:    opts,
			context: opts.Context,
		},
	)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	type createNetworkResponse struct {
		ID string
	}
	var (
		network Network
		cnr     createNetworkResponse
	)
	if err := json.NewDecoder(resp.Body).Decode(&cnr); err != nil {
		return nil, err
	}

	network.Name = opts.Name
	network.ID = cnr.ID
	network.Driver = opts.Driver

	return &network, nil
}
516853
func (b *BigIP) CreatePoolMember(pool string, config *PoolMember) error {
	return b.post(config, uriLtm, uriPool, pool, uriPoolMember)
}
963984
func Create(ctx context.Context, client client.ContainerAPIClient, name string, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig) (*Container, error) {
	container, err := client.ContainerCreate(ctx, config, hostConfig, networkingConfig, name)
	if err != nil {
		return nil, err
	}
	return New(ctx, client, container.ID)
}
376168
func createNet(d *Daemon, w http.ResponseWriter, r *http.Request) *HttpErr {
	if r.Body == nil {
		return &HttpErr{http.StatusBadRequest, "request body is empty"}
	}

	network := &Network{}
	err := json.NewDecoder(r.Body).Decode(network)

	if err != nil {
		return &HttpErr{http.StatusInternalServerError, err.Error()}
	}

	_, cidr, err := net.ParseCIDR(network.Subnet)

	if err != nil {
		return &HttpErr{http.StatusInternalServerError, err.Error()}
	}

	newNet, err := CreateNetwork(network.Name, cidr)

	if err != nil {
		return &HttpErr{http.StatusInternalServerError, err.Error()}
	}

	data, _ := json.Marshal(newNet)

	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	w.Write(data)

	return nil
}
1035526
func (f *Facade) CreateDefaultPool(ctx datastore.Context, id string) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateDefaultPool"))
	alog := f.auditLogger.Message(ctx, "Adding ResourcePool").
		ID(id).Type(pool.GetType()).Action(audit.Add)
	entity, err := f.GetResourcePool(ctx, id)
	if err != nil {
		alog.Error(err)
		return fmt.Errorf("could not create default pool %s: %v", id, err)
	}
	if entity != nil {
		glog.V(4).Infof("'%s' resource pool already exists", id)
		alog.Succeeded()
		return nil
	}

	glog.V(4).Infof("'%s' resource pool not found; creating...", id)
	entity = pool.New(id)
	entity.Realm = defaultRealm
	entity.Description = "Default Pool"
	entity.Permissions = pool.DFSAccess + pool.AdminAccess
	if err := f.AddResourcePool(ctx, entity); err != nil {
		return alog.Error(err)
	}
	alog.Succeeded()
	return nil
}
698462
func NewPool(opts Options) Pool {
	p := &poolOfContexts{
		ctxPool: pool.NewObjectPool(opts.ContextPoolOptions()),
		finalizersPool: newFinalizeablesArrayPool(finalizeablesArrayPoolOpts{
			Capacity:    opts.InitPooledFinalizerCapacity(),
			MaxCapacity: opts.MaxPooledFinalizerCapacity(),
			Options:     opts.FinalizerPoolOptions(),
		}),
	}

	p.finalizersPool.Init()
	p.ctxPool.Init(func() interface{} {
		return newPooledContext(p)
	})

	return p
}
1262385
func (b *BigIP) SnatPools() (*SnatPools, error) {
	var snatPools SnatPools
	err, _ := b.getForEntity(&snatPools, uriLtm, uriSnatPool)
	if err != nil {
		return nil, err
	}

	return &snatPools, nil
}
839760
func CreateCertPool(caCert string) (*x509.CertPool, error) {

	pool := x509.NewCertPool()
	if caCert != "" {
		xcert, err := cert.ParseCert(caCert)
		if err != nil {
			return nil, errors.Annotatef(err, "cannot parse certificate %q", caCert)
		}
		pool.AddCert(xcert)
	}

	count := processCertDir(pool)
	if count >= 0 {
		logger.Debugf("added %d certs to the pool from %s", count, certDir)
	}

	return pool, nil
}