// CreateGlance creates a glance in the room specified by the id.
//
// HipChat API docs: https://www.hipchat.com/docs/apiv2/method/create_room_glance
179205
func (r *RoomService) CreateGlance(id string, glanceReq *GlanceRequest) (*http.Response, error) {
	req, err := r.client.NewRequest("PUT", fmt.Sprintf("room/%s/extension/glance/%s", id, glanceReq.Key), nil, glanceReq)
	if err != nil {
		return nil, err
	}

	return r.client.Do(req, nil)
}
688537
func (api *Client) CreateGather(id string, data *CreateGatherData) (string, error) {
	_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "gather"), nil, data)
	if err != nil {
		return "", err
	}
	return getIDFromLocationHeader(headers), nil
}
1237624
func (f *Field) createViewIfNotExists(name string) (*view, error) {
	view, created, err := f.createViewIfNotExistsBase(name)
	if err != nil {
		return nil, err
	}

	if created {
		// Broadcast view creation to the cluster.
		err = f.broadcaster.SendSync(
			&CreateViewMessage{
				Index: f.index,
				Field: f.name,
				View:  name,
			})
		if err != nil {
			return nil, errors.Wrap(err, "sending CreateView message")
		}
	}

	return view, nil
}
104723
func (g *Cloud) CreateBetaHealthCheck(hc *computebeta.HealthCheck) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newHealthcheckMetricContextWithVersion("create", computeBetaVersion)
	return mc.Observe(g.c.BetaHealthChecks().Insert(ctx, meta.GlobalKey(hc.Name), hc))
}
283575
func CreateRenderer(window *Window, index int, flags uint32) (*Renderer, error) {
	renderer := C.SDL_CreateRenderer(window.cptr(), C.int(index), C.Uint32(flags))
	if renderer == nil {
		return nil, GetError()
	}
	return (*Renderer)(unsafe.Pointer(renderer)), nil
}
504270
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
	return d.create(id, parent, opts, true)
}
1372869
func (o *GatewaySecurity) CreateGlobalMetadata(child *GlobalMetadata) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
245568
func (r *GormWorkItemTypeGroupRepository) Create(ctx context.Context, g WorkItemTypeGroup) (*WorkItemTypeGroup, error) {
	defer goa.MeasureSince([]string{"goa", "db", "workitemtypegroup", "create"}, time.Now())
	if len(g.TypeList) <= 0 {
		return nil, errors.NewBadParameterError("type_list", g.TypeList).Expected("not empty")
	}
	if g.ID == uuid.Nil {
		g.ID = uuid.NewV4()
	}
	db := r.db.Create(&g)
	if db.Error != nil {
		return nil, errors.NewInternalError(ctx, db.Error)
	}
	log.Debug(ctx, map[string]interface{}{"witg_id": g.ID}, "created work item type group")
	// Create entries for each member in the type list
	for idx, ID := range g.TypeList {
		member := typeGroupMember{
			TypeGroupID:    g.ID,
			WorkItemTypeID: ID,
			Position:       idx,
		}
		db = db.Create(&member)
		if db.Error != nil {
			return nil, errors.NewInternalError(ctx, db.Error)
		}
	}
	return &g, nil
}
1061860
func (s Text) Create(d Dialect) (string, error) {
	compiled := "TEXT"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}
90023
func (o *Enterprise) CreateGroup(child *Group) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
984059
func (d *database) CreateArangoSearchView(ctx context.Context, name string, options *ArangoSearchViewProperties) (ArangoSearchView, error) {
	input := struct {
		Name                       string   `json:"name"`
		Type                       ViewType `json:"type"`
		ArangoSearchViewProperties          // `json:"properties"`
	}{
		Name: name,
		Type: ViewTypeArangoSearch,
	}
	if options != nil {
		input.ArangoSearchViewProperties = *options
	}
	req, err := d.conn.NewRequest("POST", path.Join(d.relPath(), "_api/view"))
	if err != nil {
		return nil, WithStack(err)
	}
	if _, err := req.SetBody(input); err != nil {
		return nil, WithStack(err)
	}
	applyContextSettings(ctx, req)
	resp, err := d.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(201); err != nil {
		return nil, WithStack(err)
	}
	view, err := newView(name, input.Type, d)
	if err != nil {
		return nil, WithStack(err)
	}
	result, err := view.ArangoSearchView()
	if err != nil {
		return nil, WithStack(err)
	}

	return result, nil
}
1084479
func (c *cmd) createSessionForeign() (string, error) {
	// Look for a remote node to bind to
	health := c.apiclient.Health()
	services, _, err := health.Service("consul", "", true, nil)
	if err != nil {
		return "", fmt.Errorf("Failed to find Consul server in remote datacenter: %v", err)
	}
	if len(services) == 0 {
		return "", fmt.Errorf("Failed to find Consul server in remote datacenter")
	}
	node := services[0].Node.Node
	if c.conf.verbose {
		c.UI.Info(fmt.Sprintf("Binding session to remote node %s@%s", node, c.http.Datacenter()))
	}

	session := c.apiclient.Session()
	se := api.SessionEntry{
		Name:     fmt.Sprintf("Remote Exec via %s@%s", c.conf.localNode, c.conf.localDC),
		Node:     node,
		Checks:   []string{},
		Behavior: api.SessionBehaviorDelete,
		TTL:      rExecTTL,
	}
	id, _, err := session.CreateNoChecks(&se, nil)
	return id, err
}
1014981
func (glpeer *GLPeer) Initialize(glc *GLContext) {
	simlog.FuncIn()

	glpeer.mu.Lock()
	defer glpeer.mu.Unlock()
	glpeer.glc = glc
	glpeer.startTime = time.Now()

	glctx := glc.glcontext

	// transparency of png
	glctx.Enable(gl.BLEND)
	glctx.BlendEquation(gl.FUNC_ADD)
	glctx.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	glpeer.images = glutil.NewImages(glctx)
	glpeer.fps = debug.NewFPS(glpeer.images)
	glpeer.initEng()

	simlog.FuncOut()
}
412506
func (s *Session) GuildChannelCreateComplex(guildID string, data GuildChannelCreateData) (st *Channel, err error) {
	body, err := s.RequestWithBucketID("POST", EndpointGuildChannels(guildID), data, EndpointGuildChannels(guildID))
	if err != nil {
		return
	}

	err = unmarshal(body, &st)
	return
}
1128691
func (h *Holder) CreateIndexIfNotExists(name string, opt IndexOptions) (*Index, error) {
	h.mu.Lock()
	defer h.mu.Unlock()

	// Find index in cache first.
	if index := h.indexes[name]; index != nil {
		return index, nil
	}

	return h.createIndex(name, opt)
}
426020
func create(ctx context.Context, client *containerd.Client, i containerd.Image, id string, previous string) (*revision, error) {
	diffIDs, err := i.RootFS(ctx)
	if err != nil {
		return nil, err
	}
	var (
		parent = identity.ChainID(diffIDs).String()
		r      = newRevision(id)
	)
	labels := map[string]string{
		gcRoot:     r.Timestamp.Format(time.RFC3339),
		imageLabel: i.Name(),
	}
	if previous != "" {
		labels[previousRevision] = previous
	}
	mounts, err := client.SnapshotService(containerd.DefaultSnapshotter).Prepare(ctx, r.Key, parent, snapshots.WithLabels(labels))
	if err != nil {
		return nil, err
	}
	r.mounts = mounts
	return r, nil
}
507953
func (window *Window) GLCreateContext() (GLContext, error) {
	c := GLContext(C.SDL_GL_CreateContext(window.cptr()))
	if c == nil {
		return nil, GetError()
	}
	return c, nil
}