def rest_couchbase( opts, spec: str, check_sink_credential: bool = False ) -> Tuple[couchbaseConstants.PUMP_ERROR, Optional[Dict[str, Any]]]: spec = spec.replace('couchbase://', 'http://') username = opts.username password = opts.password if check_sink_credential and opts.username_dest is not None and opts.password_dest is not None: username = opts.username_dest password = opts.password_dest rest = ClusterManager(spec, username, password, opts.ssl, False, None, False) result, errors = rest.list_buckets(True) if errors: return errors[0], None buckets = [] for bucket in result: if bucket["bucketType"] in ["membase", "couchbase", "ephemeral"]: buckets.append(bucket) return 0, { 'spec': spec, 'buckets': buckets, 'spec_parts': parse_spec(opts, spec, 8091) }
def rest_couchbase(opts, spec): spec = spec.replace('couchbase://', 'http://') spec_parts = parse_spec(opts, spec, 8091) rest = ClusterManager(spec, opts.username, opts.password, opts.ssl, False, None, False) result, errors = rest.list_buckets(True) if errors: return errors[0], None buckets = [] for bucket in result: if bucket["bucketType"] in ["membase", "couchbase", "ephemeral"]: buckets.append(bucket) return 0, {'spec': spec, 'buckets': buckets, 'spec_parts': parse_spec(opts, spec, 8091)}