brn

package
v0.0.0-...-d691e2b Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package brn provides a parser for interacting with BCE Resource Names.

Index

Constants

This section is empty.

Variables

View Source
var (
	RegAlias = regexp.MustCompile("^[a-zA-Z0-9-_]+$")

	RegNotMatchErr = errors.New(`member must satisfy regular expression pattern: (brn:(cloud[a-zA-Z-]*)?:faas:)?([a-z]{2,5}[0-9]*:)?([0-9a-z]{32}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?`)
)

Functions

func DealFName

func DealFName(accountID, fName string) (thumbnailName, version, alias string, err error)

fName = ThumbnailName/Uid-ThumbnailName/FuncBrn

func DealFName1

func DealFName1(accountID, fName string) (thumbnailName, version, uidStr string, err error)

fName = ThumbnailName/Uid-ThumbnailName/FuncBrn

func GenerateCommonBrn

func GenerateCommonBrn(service, region, uid, resource, qualifier string) string

func GenerateFuncBrnString

func GenerateFuncBrnString(region, uid, functionName, qualifier string) string

func GetVersionAndAlias

func GetVersionAndAlias(qualifier string) (version, alias string)

func JudgeQualifier

func JudgeQualifier(qualifier string) (string, error)

func JudgeUnderlyingBrn

func JudgeUnderlyingBrn(underlyingBrn string) (string, error)

func Md5BceUid

func Md5BceUid(uid string) string

func SimplifyFunctionNameAndQualifier

func SimplifyFunctionNameAndQualifier(functionName, qualifier string) (string, string)

SimplifyFunctionNameAndQualifier TODO: partial function name

Types

type BRN

type BRN struct {
	// The partition that the resource is in. For standard BCE regions, the partition is "cloud". If you have resources in
	// other partitions, the partition is "cloud-partitionname". For example, the partition for resources in the China
	// (Beijing) region is "cloud-cn".
	Partition string

	// The service namespace that identifies the BCE product. For a list of namespaces, see
	// http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces.
	Service string

	// The region the resource resides in. Note that the BRNs for some resources do not require a region, so this
	// component might be omitted.
	Region string

	// The ID of the BCE account that owns the resource, without the hyphens. For example, 123456789012. Note that the
	// BRNs for some resources don't require an account number, so this component might be omitted.
	AccountID string

	// The content of this part of the BRN varies by service. It often includes an indicator of the type of resource —
	// for example, an IAM user or BCE RDS database - followed by a slash (/) or a colon (:), followed by the
	// resource name itself. Some services allows paths for resource names, as described in
	// http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arns-paths.
	Resource string
}

BRN captures the individual fields of an BCE Resource Name. See http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html for more information.

func Parse

func Parse(brn string) (BRN, error)

Parse parses an BRN into its constituent parts.

Some example BRNs: brn:cloud:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment brn:cloud:iam::123456789012:user/David brn:cloud:rds:eu-west-1:123456789012:db:mysql-db brn:cloud:s3:::my_corporate_bucket/exampleobject.png

func (BRN) String

func (brn BRN) String() string

String returns the canonical representation of the BRN

type FunctionBRN

type FunctionBRN struct {
	BRN
	FunctionName string
	Version      string
	Alias        string
}

func GenerateFunctionBRN

func GenerateFunctionBRN(region, uid, functionName, qualifier string) FunctionBRN

func ParseFunction

func ParseFunction(brn string) (FunctionBRN, error)

Jump to

Keyboard shortcuts

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