Generalize replication target management so that remote targets for a bucket can be managed with ARNs. `mc admin bucket remote` command will be used to manage targets.
Showing the changes to cmd/api-errors.go (1 of 15 files). Show all
Unified · Split
| @@ -108,6 +108,11 @@ const ( · 107 unmodified lines | ||
| 108 | 108 | ErrReplicationConfigurationNotFoundError |
| 109 | 109 | ErrReplicationDestinationNotFoundError |
| 110 | 110 | ErrReplicationTargetNotFoundError |
| 111 | + ErrBucketRemoteIdenticalToSource | |
| 112 | + ErrBucketRemoteAlreadyExists | |
| 113 | + ErrBucketRemoteArnTypeInvalid | |
| 114 | + ErrBucketRemoteArnInvalid | |
| 115 | + ErrBucketRemoteRemoveDisallowed | |
| 111 | 116 | ErrReplicationTargetNotVersionedError |
| 112 | 117 | ErrReplicationNeedsVersioningError |
| 113 | 118 | ErrReplicationBucketNeedsVersioningError |
| @@ -826,14 +831,39 @@ var errorCodes = errorCodeMap{ · 712 unmodified lines | ||
| 826 | 831 | HTTPStatusCode: http.StatusNotFound, |
| 827 | 832 | }, |
| 828 | 833 | ErrReplicationTargetNotFoundError: { |
| 829 | − Code: "ReplicationTargetNotFoundError", | |
| 834 | + Code: "XminioAdminReplicationTargetNotFoundError", | |
| 830 | 835 | Description: "The replication target does not exist", |
| 831 | 836 | HTTPStatusCode: http.StatusNotFound, |
| 832 | 837 | }, |
| 838 | + ErrBucketRemoteIdenticalToSource: { | |
| 839 | + Code: "XminioAdminRemoteIdenticalToSource", | |
| 840 | + Description: "The remote target cannot be identical to source", | |
| 841 | + HTTPStatusCode: http.StatusBadRequest, | |
| 842 | + }, | |
| 843 | + ErrBucketRemoteAlreadyExists: { | |
| 844 | + Code: "XminioAdminBucketRemoteAlreadyExists", | |
| 845 | + Description: "The remote target already exists", | |
| 846 | + HTTPStatusCode: http.StatusBadRequest, | |
| 847 | + }, | |
| 848 | + ErrBucketRemoteRemoveDisallowed: { | |
| 849 | + Code: "XMinioAdminRemoteRemoveDisallowed", | |
| 850 | + Description: "Replication configuration exists with this ARN.", | |
| 851 | + HTTPStatusCode: http.StatusBadRequest, | |
| 852 | + }, | |
| 853 | + ErrBucketRemoteArnTypeInvalid: { | |
| 854 | + Code: "XMinioAdminRemoteARNTypeInvalid", | |
| 855 | + Description: "The bucket remote ARN type is not valid", | |
| 856 | + HTTPStatusCode: http.StatusBadRequest, | |
| 857 | + }, | |
| 858 | + ErrBucketRemoteArnInvalid: { | |
| 859 | + Code: "XMinioAdminRemoteArnInvalid", | |
| 860 | + Description: "The bucket remote ARN does not have correct format", | |
| 861 | + HTTPStatusCode: http.StatusBadRequest, | |
| 862 | + }, | |
| 833 | 863 | ErrReplicationTargetNotVersionedError: { |
| 834 | 864 | Code: "ReplicationTargetNotVersionedError", |
| 835 | 865 | Description: "The replication target does not have versioning enabled", |
| 836 | − HTTPStatusCode: http.StatusNotFound, | |
| 866 | + HTTPStatusCode: http.StatusBadRequest, | |
| 837 | 867 | }, |
| 838 | 868 | ErrReplicationNeedsVersioningError: { |
| 839 | 869 | Code: "InvalidRequest", |
| @@ -1879,8 +1909,16 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { · 1039 unmodified lines | ||
| 1879 | 1909 | apiErr = ErrReplicationConfigurationNotFoundError |
| 1880 | 1910 | case BucketReplicationDestinationNotFound: |
| 1881 | 1911 | apiErr = ErrReplicationDestinationNotFoundError |
| 1882 | − case BucketReplicationTargetNotFound: | |
| 1912 | + case BucketRemoteTargetNotFound: | |
| 1883 | 1913 | apiErr = ErrReplicationTargetNotFoundError |
| 1914 | + case BucketRemoteAlreadyExists: | |
| 1915 | + apiErr = ErrBucketRemoteAlreadyExists | |
| 1916 | + case BucketRemoteArnTypeInvalid: | |
| 1917 | + apiErr = ErrBucketRemoteArnTypeInvalid | |
| 1918 | + case BucketRemoteArnInvalid: | |
| 1919 | + apiErr = ErrBucketRemoteArnInvalid | |
| 1920 | + case BucketRemoteRemoveDisallowed: | |
| 1921 | + apiErr = ErrBucketRemoteRemoveDisallowed | |
| 1884 | 1922 | case BucketReplicationTargetNotVersioned: |
| 1885 | 1923 | apiErr = ErrReplicationTargetNotVersionedError |
| 1886 | 1924 | case BucketQuotaExceeded: |