Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed Mar 16, 2022
1 parent adcb22f commit f3f45b2
Showing 1 changed file with 0 additions and 161 deletions.
161 changes: 0 additions & 161 deletions internal/service/s3/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -2029,167 +2029,6 @@ func grantHash(v interface{}) int {
return create.StringHashcode(buf.String())
}

func rulesHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["prefix"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["status"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", destinationHash(v[0])))
}
if v, ok := m["source_selection_criteria"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", sourceSelectionCriteriaHash(v[0])))
}
if v, ok := m["priority"]; ok {
buf.WriteString(fmt.Sprintf("%d-", v.(int)))
}
if v, ok := m["filter"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", replicationRuleFilterHash(v[0])))

if v, ok := m["delete_marker_replication_status"]; ok && v.(string) == s3.DeleteMarkerReplicationStatusEnabled {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
}
return create.StringHashcode(buf.String())
}

func replicationRuleFilterHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["prefix"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["tags"]; ok {
buf.WriteString(fmt.Sprintf("%d-", tftags.New(v).Hash()))
}
return create.StringHashcode(buf.String())
}

func destinationHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["bucket"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["storage_class"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["replica_kms_key_id"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["account"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
if v, ok := m["access_control_translation"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", accessControlTranslationHash(v[0])))
}
if v, ok := m["replication_time"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", replicationTimeHash(v[0])))
}
if v, ok := m["metrics"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", metricsHash(v[0])))
}
return create.StringHashcode(buf.String())
}

func accessControlTranslationHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["owner"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return create.StringHashcode(buf.String())
}

func metricsHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["minutes"]; ok {
buf.WriteString(fmt.Sprintf("%d-", v.(int)))
}
if v, ok := m["status"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return create.StringHashcode(buf.String())
}

func replicationTimeHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["minutes"]; ok {
buf.WriteString(fmt.Sprintf("%d-", v.(int)))
}
if v, ok := m["status"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return create.StringHashcode(buf.String())
}

func sourceSelectionCriteriaHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["sse_kms_encrypted_objects"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
buf.WriteString(fmt.Sprintf("%d-", sourceSseKmsObjectsHash(v[0])))
}
return create.StringHashcode(buf.String())
}

func sourceSseKmsObjectsHash(v interface{}) int {
var buf bytes.Buffer
m, ok := v.(map[string]interface{})

if !ok {
return 0
}

if v, ok := m["enabled"]; ok {
buf.WriteString(fmt.Sprintf("%t-", v.(bool)))
}
return create.StringHashcode(buf.String())
}

type S3Website struct {
Endpoint, Domain string
}
Expand Down

0 comments on commit f3f45b2

Please sign in to comment.