Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalid = errors.New("invalid ARN")
ErrInvalid is returned when an ARN fails validation checks.
Functions ¶
Types ¶
type ResourceName ¶
type ResourceName struct {
// Scheme is always "arn". Placed here for future compatibility.
Scheme string
// Partition is the partition that the resource is in.
Partition string
// Service identifies the actual product.
Service string
// Region is the region the resource resides in.
// This component can sometimes be omitted, depends on the implementation.
Region string
// AccountID is the ID of the account that owns the resource.
// This can be ignored in most of the cases when the resource itself can be identified
// (eg. when the resource is unique).
AccountID string
// ResourceType is the optional type of resource.
// Whether it is required or not depends entirely on the implementation.
ResourceType string
// ResourceDelimiter delimits the ResourceType and the Resource.
// It is necessary to be stored here in order to restore the original Scheme.
ResourceDelimiter string
// Resource is the actual identifier of the resource.
Resource string
}
ResourceName represents the actual resource name.
func Parse ¶
func Parse(arn string) (*ResourceName, error)
Parse accepts an ARN parses it into a ResourceName.
Example ¶
package main
import (
"fmt"
"github.com/goph/arn"
)
func main() {
resourceName, err := arn.Parse("arn:aws:rds:eu-west-1:123456789012:db:mysql-db")
if err != nil {
panic(err)
}
fmt.Println(resourceName.String())
}
Output: arn:aws:rds:eu-west-1:123456789012:db:mysql-db
func (*ResourceName) ResourceValue ¶
func (n *ResourceName) ResourceValue() string
ResourceValue returns the last component of the ARN.
func (*ResourceName) String ¶
func (n *ResourceName) String() string
String returns the original ARN.
Click to show internal directories.
Click to hide internal directories.