@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.eviction_policy is not None) and (opts.eviction_policy not in ['valueOnly', 'fullEviction', 'noEviction', 'nruEviction'])):
        _exit_if_errors([(f"argument --bucket-eviction-policy: invalid choice: '{opts.eviction_policy}'" + " (choose from 'valueOnly', 'fullEviction')")])
    (bucket, errors) = self.rest.get_bucket(opts.bucket_name)
    _exit_if_errors(errors)
    if (('bucketType' in bucket) and (bucket['bucketType'] == 'memcached')):
        _deprecated('Memcached buckets are deprecated, please use ephemeral buckets instead')
        if (opts.memory_quota is not None):
            _exit_if_errors(['--bucket-ramsize cannot be specified for a memcached bucket'])
        if (opts.replica_count is not None):
            _exit_if_errors(['--bucket-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'])
    if ((('bucketType' in bucket) and ((bucket['bucketType'] == 'memcached') or (bucket['bucketType'] == '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))):
        _exit_if_errors([f"compaction settings can not be specified for a {bucket['bucketType']} bucket"])
    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
    if opts.remove_port:
        if (opts.remove_port == '1'):
            opts.remove_port = True
        else:
            opts.remove_port = False
    (_, errors) = self.rest.edit_bucket(opts.bucket_name, opts.memory_quota, opts.durability_min_level, opts.eviction_policy, opts.replica_count, priority, opts.enable_flush, opts.max_ttl, opts.compression_mode, opts.remove_port, 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, (('bucketType' in bucket) and (bucket['bucketType'] == 'membase')))
    _exit_if_errors(errors)
    _success('Bucket edited')
@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.eviction_policy is not None) and (opts.eviction_policy not in ['valueOnly', 'fullEviction', 'noEviction', 'nruEviction'])):
        _exit_if_errors([(f"argument --bucket-eviction-policy: invalid choice: '{opts.eviction_policy}'" + " (choose from 'valueOnly', 'fullEviction')")])
    (bucket, errors) = self.rest.get_bucket(opts.bucket_name)
    _exit_if_errors(errors)
    if (('bucketType' in bucket) and (bucket['bucketType'] == 'memcached')):
        _deprecated('Memcached buckets are deprecated, please use ephemeral buckets instead')
        if (opts.memory_quota is not None):
            _exit_if_errors(['--bucket-ramsize cannot be specified for a memcached bucket'])
        if (opts.replica_count is not None):
            _exit_if_errors(['--bucket-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'])
    if ((('bucketType' in bucket) and ((bucket['bucketType'] == 'memcached') or (bucket['bucketType'] == '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))):
        _exit_if_errors([f"compaction settings can not be specified for a {bucket['bucketType']} bucket"])
    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
    if opts.remove_port:
        if (opts.remove_port == '1'):
            opts.remove_port = True
        else:
            opts.remove_port = False
    (_, errors) = self.rest.edit_bucket(opts.bucket_name, opts.memory_quota, opts.durability_min_level, opts.eviction_policy, opts.replica_count, priority, opts.enable_flush, opts.max_ttl, opts.compression_mode, opts.remove_port, 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, (('bucketType' in bucket) and (bucket['bucketType'] == 'membase')))
    _exit_if_errors(errors)
    _success('Bucket edited')