MCPcopy
hub / github.com/minio/minio-go / NewArnFromString

Function NewArnFromString

pkg/notification/notification.go:122–132  ·  view source on GitHub ↗

NewArnFromString parses string representation of ARN into Arn object. Returns an error if the string format is incorrect.

(arn string)

Source from the content-addressed store, hash-verified

120// NewArnFromString parses string representation of ARN into Arn object.
121// Returns an error if the string format is incorrect.
122func NewArnFromString(arn string) (Arn, error) {
123 parts := strings.Split(arn, ":")
124 if len(parts) != 6 {
125 return Arn{}, ErrInvalidArnFormat
126 }
127 if parts[0] != "arn" {
128 return Arn{}, ErrInvalidArnPrefix
129 }
130
131 return NewArn(parts[1], parts[2], parts[3], parts[4], parts[5]), nil
132}
133
134// String returns the string format of the ARN
135func (arn Arn) String() string {

Callers 1

TestNewArnFromStringFunction · 0.85

Calls 1

NewArnFunction · 0.85

Tested by 1

TestNewArnFromStringFunction · 0.68