def do_replication_policy(vault, zenko_bucket): name = util.gen_bucket_name('crr-policy-test') doc = util.format_json(conf.REPL_POLICY_TPL, src=zenko_bucket.name, dest=conf.DO_CRR_TARGET_BUCKET) policy = vault.create_policy(PolicyName=name, PolicyDocument=doc) return (zenko_bucket, policy)
def encrypted_bucket(aws_endpoint_resource): auth = S3Auth(conf.ZENKO_ACCESS_KEY, conf.ZENKO_SECRET_KEY, service_url=conf.ZENKO_AWS_ENDPOINT) name = util.gen_bucket_name() url = '%s/%s/' % (conf.ZENKO_AWS_ENDPOINT, name) headers = {'x-amz-scal-server-side-encryption': 'AES256'} requests.put(url, auth=auth, headers=headers, verify=conf.VERIFY_CERTIFICATES) bucket = create_bucket(aws_endpoint_resource, name) yield bucket util.cleanup_bucket(bucket)
def multi_replication_policy(vault, zenko_bucket): name = util.gen_bucket_name('crr-policy-test') doc = util.format_json(conf.MULTI_REPL_POLICY_TPL_PT1, src=zenko_bucket.name, as_string=False) for target in conf.MULTI_CRR_TARGETS: bucket = getattr(conf, '%s_CRR_TARGET_BUCKET' % target) dest = util.format_json(conf.MULTI_REPL_POLICY_TPL_PT2, dest=bucket, as_string=False) doc['Statement'].append(dest) print(doc) doc = json.dumps(doc) policy = vault.create_policy(PolicyName=name, PolicyDocument=doc) return (zenko_bucket, policy)
def crr_role(vault): name = util.gen_bucket_name('crr-role-test') return vault.create_role(RoleName=name, AssumeRolePolicyDocument=conf.ROLE_CONF)
def zenko_bucket(zenko_resource): name = util.gen_bucket_name() bucket = create_bucket(zenko_resource, name) yield bucket util.cleanup_bucket(bucket)
def digital_ocean_ep_bucket(digital_ocean_endpoint_resource): name = util.gen_bucket_name() bucket = create_bucket(digital_ocean_endpoint_resource, name) yield bucket util.cleanup_bucket(bucket)
def wasabi_ep_bucket(wasabi_endpoint_resource): name = util.gen_bucket_name() bucket = create_bucket(wasabi_endpoint_resource, name) yield bucket util.cleanup_bucket(bucket)