// WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used
503106
func (builder *FetchBucketPropsCommandBuilder) WithBucketType(bucketType string) *FetchBucketPropsCommandBuilder {
	builder.protobuf.Type = []byte(bucketType)
	return builder
}
1323847
func (s *S3ReferenceDataSourceDescription) SetBucketARN(v string) *S3ReferenceDataSourceDescription {
	s.BucketARN = &v
	return s
}
158950
func (r *BulkDeleteRequest) Type(typ string) *BulkDeleteRequest {
	r.typ = typ
	r.source = nil
	return r
}
745047
func (s *ListBackupsInput) SetBackupType(v string) *ListBackupsInput {
	s.BackupType = &v
	return s
}
877152
func (builder *StoreBucketTypePropsCommandBuilder) WithSearchIndex(searchIndex string) *StoreBucketTypePropsCommandBuilder {
	builder.props.SearchIndex = []byte(searchIndex)
	return builder
}
469066
func (s *BackupDetails) SetBackupType(v string) *BackupDetails {
	s.BackupType = &v
	return s
}
63756
func WithSeekType(seek seek.Type) ClientOption {
	return func(c *Client) error {
		c.seekType = seek
		return nil
	}
}
225140
func (builder *FetchValueCommandBuilder) WithBucket(bucket string) *FetchValueCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
10927
func (tx *Tx) Bucket(b []byte) (kv.Bucket, error) {
	bkt := tx.tx.Bucket(b)
	if bkt == nil {
		return tx.createBucketIfNotExists(b)
	}
	return &Bucket{
		bucket: bkt,
	}, nil
}
473619
func (builder *UpdateHllCommandBuilder) WithBucketType(bucketType string) *UpdateHllCommandBuilder {
	builder.protobuf.Type = []byte(bucketType)
	return builder
}
852070
func (builder *UpdateSetCommandBuilder) WithBucket(bucket string) *UpdateSetCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
735712
func (builder *StoreBucketTypePropsCommandBuilder) WithChashKeyFun(val *ModFun) *StoreBucketTypePropsCommandBuilder {
	builder.props.ChashKeyfun = &rpbRiak.RpbModFun{
		Module:   []byte(val.Module),
		Function: []byte(val.Function),
	}
	return builder
}
1066186
func WithBucketsExponent(bucketExp uint) Option {
	return func(opts *opts) {
		opts.size = uint64(1 << bucketExp)
	}
}
350403
func (s *CreateBrokerRequest) SetHostInstanceType(v string) *CreateBrokerRequest {
	s.HostInstanceType = &v
	return s
}
790339
func WithSeekType(value seek.Type) options.Opt {
	return func(p options.Params) {
		if setter, ok := p.(seekTypeSetter); ok {
			setter.SetSeekType(value)
		}
	}
}
565135
func (s *DocumentDescription) SetHashType(v string) *DocumentDescription {
	s.HashType = &v
	return s
}
628980
func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Request) {
	ctx := newContext(r, w, "PutBucket")

	defer logger.AuditLog(w, r, "PutBucket", mustGetClaimsFromToken(r))

	objectAPI := api.ObjectAPI()
	if objectAPI == nil {
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL, guessIsBrowserReq(r))
		return
	}

	vars := mux.Vars(r)
	bucket := vars["bucket"]

	if s3Error := checkRequestAuthType(ctx, r, policy.CreateBucketAction, bucket, ""); s3Error != ErrNone {
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL, guessIsBrowserReq(r))
		return
	}

	// Parse incoming location constraint.
	location, s3Error := parseLocationConstraint(r)
	if s3Error != ErrNone {
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL, guessIsBrowserReq(r))
		return
	}

	// Validate if location sent by the client is valid, reject
	// requests which do not follow valid region requirements.
	if !isValidLocation(location) {
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidRegion), r.URL, guessIsBrowserReq(r))
		return
	}

	if globalDNSConfig != nil {
		if _, err := globalDNSConfig.Get(bucket); err != nil {
			if err == dns.ErrNoEntriesFound {
				// Proceed to creating a bucket.
				if err = objectAPI.MakeBucketWithLocation(ctx, bucket, location); err != nil {
					writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
					return
				}
				if err = globalDNSConfig.Put(bucket); err != nil {
					objectAPI.DeleteBucket(ctx, bucket)
					writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
					return
				}

				// Make sure to add Location information here only for bucket
				w.Header().Set("Location", getObjectLocation(r, globalDomainNames, bucket, ""))

				writeSuccessResponseHeadersOnly(w)
				return
			}
			writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
			return

		}
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrBucketAlreadyOwnedByYou), r.URL, guessIsBrowserReq(r))
		return
	}

	// Proceed to creating a bucket.
	err := objectAPI.MakeBucketWithLocation(ctx, bucket, location)
	if err != nil {
		writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
		return
	}

	// Make sure to add Location information here only for bucket
	w.Header().Set("Location", path.Clean(r.URL.Path)) // Clean any trailing slashes.

	writeSuccessResponseHeadersOnly(w)
}