Skip to content

Commit

Permalink
Supporting code for bucket-level CORS configuration settings with S3 …
Browse files Browse the repository at this point in the history
…APIs (#290)
  • Loading branch information
marktheunissen authored Jul 31, 2024
1 parent 3cfbffc commit b957f4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions bucket-metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type BucketStatus struct {
Lifecycle MetaStatus `json:"lifecycle"`
Notification MetaStatus `json:"notification"`
Quota MetaStatus `json:"quota"`
Cors MetaStatus `json:"cors"`
Err string `json:"error,omitempty"`
}

Expand Down
11 changes: 11 additions & 0 deletions cluster-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ const (
SRBucketMetaTypeSSEConfig = "sse-config"
SRBucketMetaTypeQuotaConfig = "quota-config"
SRBucketMetaLCConfig = "lc-config"
SRBucketMetaTypeCorsConfig = "cors-config"
)

// SRBucketMeta - represents a bucket metadata change that will be copied to a peer.
Expand Down Expand Up @@ -469,6 +470,9 @@ type SRBucketMeta struct {

// ExpiryUpdatedAt - timestamp of last update of expiry rule
ExpiryUpdatedAt time.Time `json:"expiryUpdatedAt,omitempty"`

// Cors is base64 XML representation of CORS config
Cors *string `json:"cors,omitempty"`
}

// SRPeerReplicateBucketMeta - copies a bucket metadata change to a peer cluster.
Expand Down Expand Up @@ -529,6 +533,8 @@ type SRBucketInfo struct {
// byte representation
ExpiryLCConfig *string `json:"expLCConfig,omitempty"`

CorsConfig *string `json:"corsConfig,omitempty"`

// time stamps of bucket metadata updates
PolicyUpdatedAt time.Time `json:"policyTimestamp,omitempty"`
TagConfigUpdatedAt time.Time `json:"tagTimestamp,omitempty"`
Expand All @@ -540,6 +546,7 @@ type SRBucketInfo struct {
ExpiryLCConfigUpdatedAt time.Time `json:"expLCTimestamp,omitempty"`
CreatedAt time.Time `json:"bucketTimestamp,omitempty"`
DeletedAt time.Time `json:"bucketDeletedTimestamp,omitempty"`
CorsConfigUpdatedAt time.Time `json:"corsTimestamp,omitempty"`
Location string `json:"location,omitempty"`
}

Expand Down Expand Up @@ -736,12 +743,14 @@ type SRBucketStatsSummary struct {
SSEConfigMismatch bool
ReplicationCfgMismatch bool
QuotaCfgMismatch bool
CorsCfgMismatch bool
HasTagsSet bool
HasOLockConfigSet bool
HasPolicySet bool
HasSSECfgSet bool
HasReplicationCfg bool
HasQuotaCfgSet bool
HasCorsCfgSet bool
}

// SRILMExpiryStatsSummary has status of ILM Expiry rules metadata replication misses
Expand All @@ -766,6 +775,7 @@ type SRSiteSummary struct {
ReplicatedUserPolicyMappings int // count of user policy mappings replicated across sites
ReplicatedGroupPolicyMappings int // count of group policy mappings replicated across sites
ReplicatedILMExpiryRules int // count of ILM expiry rules replicated across sites
ReplicatedCorsConfig int // count of CORS config replicated across sites

TotalBucketsCount int // total buckets on this site
TotalTagsCount int // total count of buckets with tags on this site
Expand All @@ -780,6 +790,7 @@ type SRSiteSummary struct {
TotalUserPolicyMappingCount int // total number of user policy mappings seen on this site
TotalGroupPolicyMappingCount int // total number of group policy mappings seen on this site
TotalILMExpiryRulesCount int // total number of ILM expiry rules seen on the site
TotalCorsConfigCount int // total number of CORS config seen on the site
}

// SREntityType specifies type of entity
Expand Down

0 comments on commit b957f4b

Please sign in to comment.