@rest_initialiser(cluster_init_check=True, version_check=True, enterprise_check=False)
def execute(self, opts):
    if (opts.max_ttl and (not self.enterprise)):
        _exit_if_errors(['Maximum TTL can only be configured on enterprise edition'])
    if (opts.compression_mode and (not self.enterprise)):
        _exit_if_errors(['Compression mode can only be configured on enterprise edition'])
    if (opts.type == 'memcached'):
        _deprecated('Memcached buckets are deprecated, please use ephemeral buckets instead')
        if (opts.replica_count is not None):
            _exit_if_errors(['--bucket-replica cannot be specified for a memcached bucket'])
        if (opts.conflict_resolution is not None):
            _exit_if_errors(['--conflict-resolution cannot be specified for a memcached bucket'])
        if (opts.replica_indexes is not None):
            _exit_if_errors(['--enable-index-replica cannot be specified for a memcached bucket'])
        if (opts.priority is not None):
            _exit_if_errors(['--bucket-priority cannot be specified for a memcached bucket'])
        if (opts.eviction_policy is not None):
            _exit_if_errors(['--bucket-eviction-policy cannot be specified for a memcached bucket'])
        if (opts.max_ttl is not None):
            _exit_if_errors(['--max-ttl cannot be specified for a memcached bucket'])
        if (opts.compression_mode is not None):
            _exit_if_errors(['--compression-mode cannot be specified for a memcached bucket'])
        if (opts.durability_min_level is not None):
            _exit_if_errors(['--durability-min-level cannot be specified for a memcached bucket'])
    elif ((opts.type == 'ephemeral') and (opts.eviction_policy in ['valueOnly', 'fullEviction'])):
        _exit_if_errors(['--bucket-eviction-policy must either be noEviction or nruEviction'])
    elif ((opts.type == 'couchbase') and (opts.eviction_policy in ['noEviction', 'nruEviction'])):
        _exit_if_errors(['--bucket-eviction-policy must either be valueOnly or fullEviction'])
    if (((opts.type == 'memcached') or (opts.type == 'ephemeral')) and ((opts.db_frag_perc is not None) or (opts.db_frag_size is not None) or (opts.view_frag_perc is not None) or (opts.view_frag_size is not None) or (opts.from_hour is not None) or (opts.from_min is not None) or (opts.to_hour is not None) or (opts.to_min is not None) or (opts.abort_outside is not None) or (opts.paralleldb_and_view_compact is not None))):
        _warning(f'ignoring compaction settings as bucket type {opts.type} does not accept it')
    storage_type = 'couchstore'
    if (opts.storage is not None):
        if (opts.type != 'couchbase'):
            _exit_if_errors(['--storage-backend is only valid for couchbase buckets'])
        if (opts.storage == 'magma'):
            storage_type = 'magma'
    priority = None
    if (opts.priority is not None):
        if (opts.priority == BUCKET_PRIORITY_HIGH_STR):
            priority = BUCKET_PRIORITY_HIGH_INT
        elif (opts.priority == BUCKET_PRIORITY_LOW_STR):
            priority = BUCKET_PRIORITY_LOW_INT
    conflict_resolution_type = None
    if (opts.conflict_resolution is not None):
        if (opts.conflict_resolution == 'sequence'):
            conflict_resolution_type = 'seqno'
        elif (opts.conflict_resolution == 'timestamp'):
            conflict_resolution_type = 'lww'
    (_, errors) = self.rest.create_bucket(opts.bucket_name, opts.type, storage_type, opts.memory_quota, opts.durability_min_level, opts.eviction_policy, opts.replica_count, opts.replica_indexes, priority, conflict_resolution_type, opts.enable_flush, opts.max_ttl, opts.compression_mode, opts.wait, opts.db_frag_perc, opts.db_frag_size, opts.view_frag_perc, opts.view_frag_size, opts.from_hour, opts.from_min, opts.to_hour, opts.to_min, opts.abort_outside, opts.paralleldb_and_view_compact, opts.purge_interval)
    _exit_if_errors(errors)
    _success('Bucket created')
@rest_initialiser(cluster_init_check=True, version_check=True, enterprise_check=False)
def execute(self, opts):
    if (opts.max_ttl and (not self.enterprise)):
        _exit_if_errors(['Maximum TTL can only be configured on enterprise edition'])
    if (opts.compression_mode and (not self.enterprise)):
        _exit_if_errors(['Compression mode can only be configured on enterprise edition'])
    if (opts.type == 'memcached'):
        _deprecated('Memcached buckets are deprecated, please use ephemeral buckets instead')
        if (opts.replica_count is not None):
            _exit_if_errors(['--bucket-replica cannot be specified for a memcached bucket'])
        if (opts.conflict_resolution is not None):
            _exit_if_errors(['--conflict-resolution cannot be specified for a memcached bucket'])
        if (opts.replica_indexes is not None):
            _exit_if_errors(['--enable-index-replica cannot be specified for a memcached bucket'])
        if (opts.priority is not None):
            _exit_if_errors(['--bucket-priority cannot be specified for a memcached bucket'])
        if (opts.eviction_policy is not None):
            _exit_if_errors(['--bucket-eviction-policy cannot be specified for a memcached bucket'])
        if (opts.max_ttl is not None):
            _exit_if_errors(['--max-ttl cannot be specified for a memcached bucket'])
        if (opts.compression_mode is not None):
            _exit_if_errors(['--compression-mode cannot be specified for a memcached bucket'])
        if (opts.durability_min_level is not None):
            _exit_if_errors(['--durability-min-level cannot be specified for a memcached bucket'])
    elif ((opts.type == 'ephemeral') and (opts.eviction_policy in ['valueOnly', 'fullEviction'])):
        _exit_if_errors(['--bucket-eviction-policy must either be noEviction or nruEviction'])
    elif ((opts.type == 'couchbase') and (opts.eviction_policy in ['noEviction', 'nruEviction'])):
        _exit_if_errors(['--bucket-eviction-policy must either be valueOnly or fullEviction'])
    if (((opts.type == 'memcached') or (opts.type == 'ephemeral')) and ((opts.db_frag_perc is not None) or (opts.db_frag_size is not None) or (opts.view_frag_perc is not None) or (opts.view_frag_size is not None) or (opts.from_hour is not None) or (opts.from_min is not None) or (opts.to_hour is not None) or (opts.to_min is not None) or (opts.abort_outside is not None) or (opts.paralleldb_and_view_compact is not None))):
        _warning(f'ignoring compaction settings as bucket type {opts.type} does not accept it')
    storage_type = 'couchstore'
    if (opts.storage is not None):
        if (opts.type != 'couchbase'):
            _exit_if_errors(['--storage-backend is only valid for couchbase buckets'])
        if (opts.storage == 'magma'):
            storage_type = 'magma'
    priority = None
    if (opts.priority is not None):
        if (opts.priority == BUCKET_PRIORITY_HIGH_STR):
            priority = BUCKET_PRIORITY_HIGH_INT
        elif (opts.priority == BUCKET_PRIORITY_LOW_STR):
            priority = BUCKET_PRIORITY_LOW_INT
    conflict_resolution_type = None
    if (opts.conflict_resolution is not None):
        if (opts.conflict_resolution == 'sequence'):
            conflict_resolution_type = 'seqno'
        elif (opts.conflict_resolution == 'timestamp'):
            conflict_resolution_type = 'lww'
    (_, errors) = self.rest.create_bucket(opts.bucket_name, opts.type, storage_type, opts.memory_quota, opts.durability_min_level, opts.eviction_policy, opts.replica_count, opts.replica_indexes, priority, conflict_resolution_type, opts.enable_flush, opts.max_ttl, opts.compression_mode, opts.wait, opts.db_frag_perc, opts.db_frag_size, opts.view_frag_perc, opts.view_frag_size, opts.from_hour, opts.from_min, opts.to_hour, opts.to_min, opts.abort_outside, opts.paralleldb_and_view_compact, opts.purge_interval)
    _exit_if_errors(errors)
    _success('Bucket created')