arn

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: BSD-3-Clause Imports: 3 Imported by: 8

Documentation

Overview

Package arn provides functions and types for working with Amazon Resource Names.

Index

Constants

View Source
const Base = ARN(prefix + "::::")

Base is an ARN without any fields set.

Variables

This section is empty.

Functions

func String

func String(r ARN) *string

String returns a pointer to the ARN value passed in.

Types

type ARN

type ARN string

ARN is an Amazon Resource Name.

func New

func New(partition, service, region, account string, resource ...string) ARN

New constructs an ARN from the specified fields. Any field may be left blank.

func Value

func Value(s *string) ARN

Value returns the value of the ARN string pointer passed in or "" if the pointer is nil.

func (ARN) Account

func (r ARN) Account() string

Account returns ARN account.

func (ARN) Ctx

func (r ARN) Ctx() Ctx

Ctx extracts the partition, region, and account fields from r.

func (ARN) Field

func (r ARN) Field(i int) string

Field returns the ith ARN field.

func (ARN) Name

func (r ARN) Name() string

Name returns the resource suffix after the last '/' or ':' character. It returns the whole resource field if neither character is found.

func (ARN) Partition

func (r ARN) Partition() string

Partition returns ARN partition.

func (ARN) Path

func (r ARN) Path() string

Path returns the resource substring between and including the first and last '/' characters. It ignores any part of the resource before the last ':' and returns an empty string if the resource does not contain any '/' characters.

func (ARN) PathName

func (r ARN) PathName() string

PathName returns the combined resource path and name. It panics if r does not have a path.

func (ARN) Region

func (r ARN) Region() string

Region returns ARN region.

func (ARN) Resource

func (r ARN) Resource() string

Resource returns ARN resource.

func (ARN) Service

func (r ARN) Service() string

Service returns ARN service.

func (ARN) Type

func (r ARN) Type() string

Type returns the resource prefix up to the first '/' or ':' character. It returns an empty string if neither character is found.

func (ARN) Valid

func (r ARN) Valid() bool

Valid returns true if r has a valid prefix and the required number of fields.

func (ARN) With

func (r ARN) With(o ARN) ARN

With returns a new ARN, with non-empty fields in o replacing those in r.

func (ARN) WithAccount

func (r ARN) WithAccount(v string) ARN

WithAccount returns a new ARN with account replaced by v.

func (ARN) WithField

func (r ARN) WithField(i int, v string) ARN

WithField returns a new ARN with the ith field set to v.

func (ARN) WithName

func (r ARN) WithName(v string) ARN

WithName returns a new ARN with name replaced by v.

func (ARN) WithPartition

func (r ARN) WithPartition(v string) ARN

WithPartition returns a new ARN with partition replaced by v.

func (ARN) WithPath

func (r ARN) WithPath(v string) ARN

WithPath returns a new ARN with path replaced by v. It panics if r does not have a path.

func (ARN) WithPathName

func (r ARN) WithPathName(v string) ARN

WithPathName returns a new ARN with path and name replaced by v. It panics if r does not have a path.

func (ARN) WithRegion

func (r ARN) WithRegion(v string) ARN

WithRegion returns a new ARN with region replaced by v.

func (ARN) WithResource

func (r ARN) WithResource(v string) ARN

WithResource returns a new ARN with resource replaced by v.

func (ARN) WithService

func (r ARN) WithService(v string) ARN

WithService returns a new ARN with service replaced by v.

type Ctx

type Ctx struct{ Partition, Region, Account string }

Ctx maintains location information for constructing context-aware ARNs.

func (Ctx) In

func (c Ctx) In(region string) Ctx

In returns a new context for the specified region. No validation is performed to ensure that the new region is valid for the current partition.

func (Ctx) New

func (c Ctx) New(service string, resource ...string) ARN

New constructs a context-aware ARN for the specified service/resource.

Jump to

Keyboard shortcuts

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