arn

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package arn provides a set of utilities for working with Amazon Resource Names (ARNs).

Index

Constants

View Source
const (
	KeyResourceType = "key"
)

Variables

View Source
var ErrMalformedArn = errors.New("malformed Key ARN")

ErrMalformedArn is returned when the ARN is malformed.

Functions

func FilterKeyIDs

func FilterKeyIDs(f FilterFunc, keyIDs []string) ([]string, error)

FilterKeyIDs filters a list of key IDs using the given filter function. It returns a list of key IDs that pass the filter.

func IsMrkArnEqual

func IsMrkArnEqual(key1, key2 string) bool

IsMrkArnEqual compares two MRK ARNs

Spec: aws-kms-mrk-match-for-decrypt

Given two KMS key arns, determines whether they refer to related KMS MRKs.

func IsValidMrkArn

func IsValidMrkArn(str string) (bool, error)

IsValidMrkArn checks if the given string can be a valid MRK ARN

Spec: aws-kms-key-arn

func IsValidMrkIdentifier

func IsValidMrkIdentifier(str string) (bool, error)

IsValidMrkIdentifier checks if the given string can be a valid MRK identifier

Spec: aws-kms-key-arn

func KeyResourceEqual

func KeyResourceEqual(key1, key2 string) (bool, error)

KeyResourceEqual checks if the given key ARNs refer to the same KMS MRK resourceID.

func ValidateKeyArn

func ValidateKeyArn(keyID string) error

ValidateKeyArn validates the keyID as an ARN.

Types

type FilterFunc

type FilterFunc func(s string) (bool, error)

FilterFunc is a function that filters a string.

Examples: IsValidMrkArn, IsValidMrkIdentifier

type KeyArn

type KeyArn struct {
	Partition    string // AWS partition, e.g. aws, aws-cn, aws-us-gov
	Service      string // AWS service, kms
	Region       string // AWS region, us-east-1, eu-west-1
	Account      string // AWS account ID, 12 digits
	ResourceType string // AWS resource type, either "key" or "alias"
	ResourceID   string // AWS resource ID, resource ID or alias name
}

KeyArn represents an AWS Key ARN.

func ParseArn

func ParseArn(str string) (*KeyArn, error)

ParseArn parses str string as an ARN (KeyArn).

func (*KeyArn) IsMrk

func (a *KeyArn) IsMrk() bool

IsMrk returns true if the ARN is a multi-region key (MRK) ARN, otherwise false.

func (*KeyArn) String

func (a *KeyArn) String() string

String returns the string representation of the ARN.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL