Skip to content

Commit

Permalink
updated encoded message resource format
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Jul 11, 2024
1 parent fd11788 commit 5e8bce2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion async/mbus/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ type EncodedResource string

func (e EncodedResource) Decode() (*Resource, error) {
ret := &Resource{}
parts := strings.Split(string(e), ";")
var parts []string
if strings.Contains(string(e), "|") {
parts = strings.Split(string(e), "|")
} else {
parts = strings.Split(string(e), ";")
}
partLen := len(parts)
if partLen < 4 {
return nil, fmt.Errorf("faield to decode mbus resource: invalid format: %v, expected:name;vendor;resourceType;uri[;region;secretURL;secretKey]", e)
Expand Down
2 changes: 1 addition & 1 deletion async/mbus/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestEncodedResource_Decode(t *testing.T) {
}{
{
description: "valid resource",
encoded: "s3_queue;aws;queue;s3_queue;us-west-1;~/.secret/aws-e2e.json",
encoded: "s3_queue|aws|queue|s3_queue|us-west-1|~/.secret/aws-e2e.json",
expected: &Resource{
Name: "s3_queue",
Vendor: "aws",
Expand Down

0 comments on commit 5e8bce2

Please sign in to comment.