// CreateBoard creates a board remote.
// Attribute currently supported as exra argument: powerUps.
// Attributes currently known to be unsupported: idBoardSource, keepFromSource.
//
// API Docs: https://developers.trello.com/reference/#boardsid
8220
func (c *Client) CreateBoard(board *Board, extraArgs Arguments) error {
	path := "boards"
	args := Arguments{
		"desc":             board.Desc,
		"name":             board.Name,
		"prefs_selfJoin":   fmt.Sprintf("%t", board.Prefs.SelfJoin),
		"prefs_cardCovers": fmt.Sprintf("%t", board.Prefs.CardCovers),
		"idOrganization":   board.IDOrganization,
	}

	if board.Prefs.Voting != "" {
		args["prefs_voting"] = board.Prefs.Voting
	}
	if board.Prefs.PermissionLevel != "" {
		args["prefs_permissionLevel"] = board.Prefs.PermissionLevel
	}
	if board.Prefs.Comments != "" {
		args["prefs_comments"] = board.Prefs.Comments
	}
	if board.Prefs.Invitations != "" {
		args["prefs_invitations"] = board.Prefs.Invitations
	}
	if board.Prefs.Background != "" {
		args["prefs_background"] = board.Prefs.Background
	}
	if board.Prefs.CardAging != "" {
		args["prefs_cardAging"] = board.Prefs.CardAging
	}

	// Expects one of "all", "calendar", "cardAging", "recap", or "voting".
	if powerUps, ok := extraArgs["powerUps"]; ok {
		args["powerUps"] = powerUps
	}

	err := c.Post(path, args, &board)
	if err == nil {
		board.client = c
	}
	return err
}
327899
func NewDashboard(title string) *Dashboard {
	dash := &Dashboard{}
	dash.Data = simplejson.New()
	dash.Data.Set("title", title)
	dash.Title = title
	dash.Created = time.Now()
	dash.Updated = time.Now()
	dash.UpdateSlug()
	return dash
}
982512
func SetupDashboard(Admin *admin.Admin) {
	// Add Dashboard
	Admin.AddMenu(&admin.Menu{Name: "Dashboard", Link: "/admin", Priority: 1})

	Admin.GetRouter().Get("/reports", ReportsDataHandler)
	initFuncMap(Admin)
}
85837
func (m *Member) GetBoards(args Arguments) (boards []*Board, err error) {
	path := fmt.Sprintf("members/%s/boards", m.ID)
	err = m.client.Get(path, args, &boards)
	for i := range boards {
		boards[i].client = m.client
	}
	return
}
605906
func (r *GormBoardRepository) Load(ctx context.Context, boardID uuid.UUID) (*Board, error) {
	log.Debug(ctx, map[string]interface{}{"board_id": boardID}, "loading work item board ")
	res := Board{}
	db := r.db.Model(&res).Where("id=?", boardID).First(&res)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{"board_id": boardID}, "work item board not found")
		return nil, errors.NewNotFoundError("work item board", boardID.String())
	}
	if err := db.Error; err != nil {
		return nil, errors.NewInternalError(ctx, err)
	}
	columns, err := r.loadColumns(ctx, res.ID)
	if err != nil {
		return nil, errs.Wrapf(err, "failed to load board columns for board with ID %s", res.ID)
	}
	res.Columns = columns
	return &res, nil
}
16683
func (s *BoardService) GetBoard(boardID int) (*Board, *Response, error) {
	apiEndpoint := fmt.Sprintf("rest/agile/1.0/board/%v", boardID)
	req, err := s.client.NewRequest("GET", apiEndpoint, nil)
	if err != nil {
		return nil, nil, err
	}

	board := new(Board)
	resp, err := s.client.Do(req, board)
	if err != nil {
		jerr := NewJiraError(resp, err)
		return nil, resp, jerr
	}

	return board, resp, nil
}
686987
func createDB(db *sql.DB) error {
	_, err := db.Exec(`
		CREATE EXTENSION IF NOT EXISTS postgis;
		CREATE TABLE IF NOT EXISTS waypoints (
			id SERIAL PRIMARY KEY,
			name TEXT NOT NULL,
			geom geometry(POINT, 4326) NOT NULL
		);
	`)
	return err
}
1004214
func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {
	var keyboard [][]KeyboardButton

	keyboard = append(keyboard, rows...)

	return ReplyKeyboardMarkup{
		ResizeKeyboard: true,
		Keyboard:       keyboard,
	}
}
984721
func (s *Service) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error) {
	d, pe := s.loadDashboard(ctx, id)
	if pe != nil {
		return nil, &platform.Error{
			Op:  OpPrefix + platform.OpFindDashboardByID,
			Err: pe,
		}
	}
	return d, nil
}
1075065
func (d *DashboardsStore) AddIDs(ctx context.Context, boards []chronograf.Dashboard) error {
	for _, board := range boards {
		update := false
		for i, cell := range board.Cells {
			// If there are is no id set, we generate one and update the dashboard
			if cell.ID == "" {
				id, err := d.IDs.Generate()
				if err != nil {
					return err
				}
				cell.ID = id
				board.Cells[i] = cell
				update = true
			}
		}
		if !update {
			continue
		}
		if err := d.Update(ctx, board); err != nil {
			return err
		}
	}
	return nil
}
90469
func (c *FakeReplicationControllers) Create(replicationController *corev1.ReplicationController) (result *corev1.ReplicationController, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(replicationcontrollersResource, c.ns, replicationController), &corev1.ReplicationController{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.ReplicationController), err
}
347761
func (c *FakeControllerRevisions) Create(controllerRevision *appsv1.ControllerRevision) (result *appsv1.ControllerRevision, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(controllerrevisionsResource, c.ns, controllerRevision), &appsv1.ControllerRevision{})

	if obj == nil {
		return nil, err
	}
	return obj.(*appsv1.ControllerRevision), err
}
928261
func (c *Client) PutDashboard(ctx context.Context, d *platform.Dashboard) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		for _, cell := range d.Cells {
			if err := c.createCellView(ctx, tx, d.ID, cell.ID, nil); err != nil {
				return err
			}
		}

		if err := c.putOrganizationDashboardIndex(ctx, tx, d); err != nil {
			return err
		}

		return c.putDashboard(ctx, tx, d)
	})
}
549619
func (s *Service) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error {
	err := s.kv.Update(ctx, func(tx Tx) error {
		d.ID = s.IDGenerator.ID()

		for _, cell := range d.Cells {
			cell.ID = s.IDGenerator.ID()

			if err := s.createCellView(ctx, tx, d.ID, cell.ID, nil); err != nil {
				return err
			}
		}

		if err := s.appendDashboardEventToLog(ctx, tx, d.ID, dashboardCreatedEvent); err != nil {
			return err
		}

		if err := s.putOrganizationDashboardIndex(ctx, tx, d); err != nil {
			return err
		}

		// TODO(desa): don't populate this here. use the first/last methods of the oplog to get meta fields.
		d.Meta.CreatedAt = s.time()

		if err := s.putDashboardWithMeta(ctx, tx, d); err != nil {
			return err
		}

		if err := s.addDashboardOwner(ctx, tx, d.ID); err != nil {
			s.Logger.Info("failed to make user owner of organization", zap.Error(err))
		}

		return nil
	})
	if err != nil {
		return &influxdb.Error{
			Err: err,
		}
	}
	return nil
}
1295715
func (s *DashboardService) CreateDashboard(ctx context.Context, d *platform.Dashboard) error {
	url, err := newURL(s.Addr, dashboardsPath)
	if err != nil {
		return err
	}

	b, err := json.Marshal(d)
	if err != nil {
		return err
	}

	req, err := http.NewRequest("POST", url.String(), bytes.NewReader(b))
	if err != nil {
		return err
	}

	req.Header.Set("Content-Type", "application/json")
	SetToken(s.Token, req)

	hc := newClient(url.Scheme, s.InsecureSkipVerify)

	resp, err := hc.Do(req)
	if err != nil {
		return err
	}

	if err := CheckError(resp, true); err != nil {
		return err
	}

	if err := json.NewDecoder(resp.Body).Decode(d); err != nil {
		return err
	}

	return nil
}
293145
func (dr *dashboardServiceImpl) UnprovisionDashboard(dashboardId int64) error {
	cmd := &models.UnprovisionDashboardCommand{Id: dashboardId}
	return bus.Dispatch(cmd)
}
601276
func (s *Service) DeleteDashboard(ctx context.Context, id platform.ID) error {
	op := OpPrefix + platform.OpDeleteDashboard
	if _, err := s.FindDashboardByID(ctx, id); err != nil {
		return &platform.Error{
			Err: err,
			Op:  op,
		}
	}
	s.dashboardKV.Delete(id.String())
	// err := s.deleteLabel(ctx, platform.LabelFilter{ResourceID: id})
	// if err != nil {
	// 	return &platform.Error{
	// 		Err: err,
	// 		Op:  op,
	// 	}
	// }
	return nil
}