multisite.create_dashboard_admin_sync_group(zonegroup_name=zonegroup_name)
return rgw_client.set_bucket_replication(bucket_name, replication)
+ def _get_replication(self, bucket_name: str):
+ rgw_client = RgwClient.admin_instance()
+ return rgw_client.get_bucket_replication(bucket_name)
+
@staticmethod
def strip_tenant_from_bucket_name(bucket_name):
# type (str) -> str
result['mfa_delete'] = versioning['MfaDelete']
result['bucket_policy'] = self._get_policy(bucket_name, daemon_name, result['owner'])
result['acl'] = self._get_acl(bucket_name, daemon_name, result['owner'])
+ result['replication'] = self._get_replication(bucket_name)
# Append the locking configuration.
locking = self._get_locking(result['owner'], daemon_name, bucket_name)
class="bold">Encryption</td>
<td>{{ selection.encryption }}</td>
</tr>
+ <tr>
+ <td i18n
+ class="bold">Replication</td>
+ <td>{{ replicationStatus }}</td>
+ </tr>
<tr>
<td i18n
class="bold">MFA Delete</td>
class="bold w-25">Bucket policy</td>
<td><pre>{{ selection.bucket_policy | json}}</pre></td>
</tr>
+ <tr>
+ <td i18n
+ class="bold w-25">Replication policy</td>
+ <td><pre>{{ selection.replication | json}}</pre></td>
+ </tr>
<tr>
<td i18n
class="bold w-25">ACL</td>
selection: any;
aclPermissions: Record<string, string[]> = {};
+ replicationStatus = $localize`Disabled`;
constructor(private rgwBucketService: RgwBucketService) {}
bucket['lock_retention_period_days'] = this.rgwBucketService.getLockDays(bucket);
this.selection = bucket;
this.aclPermissions = this.parseXmlAcl(this.selection.acl, this.selection.owner);
+ if (this.selection.replication?.['Rule']?.['Status'])
+ this.replicationStatus = this.selection.replication?.['Rule']?.['Status'];
});
}
}
<cd-help-text>
<span i18n>Enables replication for the objects in the bucket.</span>
</cd-help-text>
- <div class="mt-1">
+ <div class="mt-1"
+ *ngIf="!editing">
<cd-alert-panel type="info"
*ngIf="!multisiteStatus.status.available && !multisiteStatus.isDefaultZg"
class="me-1"
.get('bucket_policy')
.setValue(JSON.stringify(value['bucket_policy'], null, 2));
}
+ if (value['replication']) {
+ const replicationConfig = value['replication'];
+ if (replicationConfig?.['Rule']?.['Status'] === 'Enabled') {
+ this.bucketForm.get('replication').setValue(true);
+ } else {
+ this.bucketForm.get('replication').setValue(false);
+ }
+ }
this.filterAclPermissions();
}
}
except RequestException as e:
raise DashboardException(msg=str(e), component='rgw')
+ @RestClient.api_get('/{bucket_name}?replication')
+ def get_bucket_replication(self, bucket_name, request=None):
+ # pylint: disable=unused-argument
+ try:
+ result = request()
+ return result
+ except RequestException as e:
+ if e.content:
+ content = json_str_to_object(e.content)
+ if content.get('Code') == 'ReplicationConfigurationNotFoundError':
+ return None
+ raise e
+
class SyncStatus(Enum):
enabled = 'enabled'