// Bitbucket allocates and returns a new AuthHandler, using the BitbucketProvider.
354928
func Bitbucket(key, secret, callback string) *AuthHandler {
	return New(NewBitbucketProvider(key, secret, callback))
}
354309
func (c *Client) DeleteBucket(ctx context.Context, id platform.ID) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		var err error
		if pe := c.deleteBucket(ctx, tx, id); pe != nil {
			pe.Op = getOp(platform.OpDeleteBucket)
			err = pe
		}
		return err
	})
}
757139
func (c *Client) SetBucket(bucket string, nval *uint32, allowmult *bool) ([]byte, error) {
	return c.setBucket(nil, bucket, nval, allowmult)
}
264592
func (g *GroupMod) AddBucket(bkt Bucket) {
	g.Buckets = append(g.Buckets, bkt)
}
649888
func (builder *FetchPreflistCommandBuilder) WithBucket(bucket string) *FetchPreflistCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
1135972
func (t *Tx) Bucket(b []byte) (kv.Bucket, error) {
	bkt, ok := t.kv.buckets[string(b)]
	if !ok {
		return t.createBucketIfNotExists(b)
	}

	return &bucket{
		Bucket:   bkt,
		writable: t.writable,
	}, nil
}
1026526
func (s *PutBucketLifecycleInput) SetBucket(v string) *PutBucketLifecycleInput {
	s.Bucket = &v
	return s
}
253079
func (ht *HashTable) lastBucket(bucket int) int {
	for curr := bucket; ; {
		next := ht.nextBucket(curr)
		if next == 0 {
			return curr
		}
		curr = next
	}
}
1319699
func setBucketForwardingHandler(h http.Handler) http.Handler {
	fwd := handlers.NewForwarder(&handlers.Forwarder{
		PassHost:     true,
		RoundTripper: NewCustomHTTPTransport(),
	})
	return bucketForwardingHandler{fwd, h}
}
870615
func (b *Bucket) DelBucket() (err error) {
	for attempt := attempts.Start(); attempt.Next(); {
		req := &request{
			method: "DELETE",
			bucket: b.Name,
			path:   "/",
		}

		err = b.Client.query(req, nil)
		if !shouldRetry(err) {
			break
		}
	}
	return err
}
1268820
func (c *Client) PutBucket(ctx context.Context, b *platform.Bucket) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		var err error
		pe := c.putBucket(ctx, tx, b)
		if pe != nil {
			err = pe
		}
		return err
	})
}
447853
func (s *BucketService) CreateBucket(ctx context.Context, b *platform.Bucket) error {
	u, err := newURL(s.Addr, bucketPath)
	if err != nil {
		return err
	}

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

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

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

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

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

	// TODO(jsternberg): Should this check for a 201 explicitly?
	if err := CheckError(resp, true); err != nil {
		return err
	}

	var br bucketResponse
	if err := json.NewDecoder(resp.Body).Decode(&br); err != nil {
		return err
	}

	pb, err := br.toPlatform()
	if err != nil {
		return err
	}
	*b = *pb
	return nil
}
300505
func (s *Service) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error) {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	var b *influxdb.Bucket
	err := s.kv.Update(ctx, func(tx Tx) error {
		bkt, err := s.updateBucket(ctx, tx, id, upd)
		if err != nil {
			return err
		}
		b = bkt
		return nil
	})

	return b, err
}
356914
func newBucket(tx *Tx) Bucket {
	var b = Bucket{tx: tx, FillPercent: DefaultFillPercent}
	if tx.writable {
		b.buckets = make(map[string]*Bucket)
		b.nodes = make(map[pgid]*node)
	}
	return b
}
765371
func (s *PutBucketMetricsConfigurationInput) SetBucket(v string) *PutBucketMetricsConfigurationInput {
	s.Bucket = &v
	return s
}
240027
func (s *GetBucketNotificationConfigurationRequest) SetBucket(v string) *GetBucketNotificationConfigurationRequest {
	s.Bucket = &v
	return s
}
388525
func (builder *FetchSetCommandBuilder) WithBucket(bucket string) *FetchSetCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}