awsarn

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package arn provides utilities for manipulating Amazon Resource Names: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html

Index

Constants

View Source
const (
	DELIMITER = ":"
	MAXLENGHT = 6
)

Variables

This section is empty.

Functions

func AWSRegions

func AWSRegions(client *http.Client) ([]string, error)

AWSRegions returns a slice of valid AWS region names. If the nil is passed for the client then a static list of well known regions is returned rather than making an HTTP request.

func Valid

func Valid(arn string, client *http.Client) bool

Valid checks the format and content of the ARN string are valid. The http.Client is required to check the region in the ARN is valid against an authoritative AWS data source. To disable the HTTP check for the region pass nil as the client and the region will be checked against a static set of well known AWS regions only.

func ValidRegion

func ValidRegion(region string, client *http.Client) bool

ValidRegion checks the region is a valid AWS region. The http.Client is required to check the region against an authoritative AWS data source. To disable the HTTP check for the region pass nil as the client and the region will be checked against a static set of well known AWS regions only.

Types

type ARN

type ARN struct {
	Partition    string
	Service      string
	Region       string
	AccountID    string
	ResourceType string

	Resource string
	// contains filtered or unexported fields
}

ARN is a struct representing structure of an ARN.

func Parse

func Parse(arn string, client *http.Client) (ARN, error)

Parse validates an ARN string and returns an ARN type. An http.Client can be provided to validate the region against the latest regions queries from an AWS endpoint. To disable this HTTP request pass nil as the client and the region will be validated against a static set of well known AWS regions.

func (*ARN) String

func (a *ARN) String() string

String returns the AWS standard string representation of an ARN type.

type AWSIPRanges

type AWSIPRanges struct {
	SyncToken     string `json:"syncToken"`
	CreateDateStr string `json:"createDate"`
	CreateDate    time.Time

	Prefixes []struct {
		IPPrefix string `json:"ip_prefix"`
		IP       net.IP
		Network  *net.IPNet
		Region   string `json:"region"`
		Service  string `json:"service"`
	} `json:"prefixes"`

	Ipv6Prefixes []struct {
		Ipv6Prefix string `json:"ipv6_prefix"`
		IP         net.IP
		Network    *net.IPNet
		Region     string `json:"region"`
		Service    string `json:"service"`
	} `json:"ipv6_prefixes"`
}

AWSIPRanges represents the AWS ip-ranges.json document.

func AWSIPRangesDoc

func AWSIPRangesDoc(client *http.Client) (awsip AWSIPRanges, err error)

AWSIPRangesDoc reads the ip-ranges.json document from https://ip-ranges.amazonaws.com/ip-ranges.json and returns an AWSIPRanges type.

type Terminal

type Terminal struct {
	// contains filtered or unexported fields
}

func NewTerminal

func NewTerminal() *Terminal

NewTerminal init a new terminal utils for sugar purposes

Jump to

Keyboard shortcuts

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