resourceurl

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package resourceurl implements resource url parsing utilities.

Index

Constants

View Source
const (
	// ResourcePrefix is the prefix of a resource URL.
	ResourcePrefix = "https://www.googleapis.com/"
	// NumParts is the number of parts in a resource URL.
	NumParts = 8
	// ResourceCategoryIndex is the index of the resource category in resource URL parts.
	ResourceCategoryIndex = 0
	// ProjectIndex is the index of the project in resource URL parts.
	ProjectIndex = 3
	// LocationIndex is the index of the location in resource URL parts.
	LocationIndex = 5
	// SubResourceIndex is the index of the sub resource in resource URL parts.
	SubResourceIndex = 6
	// NameIndex is the index of the name in resource URL parts.
	NameIndex = 7
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceURL

type ResourceURL struct {
	// The resource category (e.g. compute)
	ResourceCategory string
	// The project where the resource lives in (e.g. my-project)
	Project string
	// The location where the resource lives in (e.g. us-central1-b)
	Location string
	// The sub-type of the resource (e.g. instanceGroupManagers)
	SubResource string
	// The name of the resource (e.g. gke-capg-gke-demo-mypool-aa1282e0-grp)
	Name string
}

ResourceURL captures the individual fields of a GCP resource URL. An example of GCP resource URL: https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-b/instanceGroupManagers/gke-capg-gke-demo-mypool-aa1282e0-grp

func Parse

func Parse(url string) (ResourceURL, error)

Parse parses a resource url.

Jump to

Keyboard shortcuts

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