resolver

package
v2.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceHierarchyRootResourceGroup = ResourceHierarchyRoot("ResourceGroup")
	ResourceHierarchyRootSubscription  = ResourceHierarchyRoot("Subscription")
)
View Source
const ResourceGroupGroup = "resources.azure.com"
View Source
const ResourceGroupKind = "ResourceGroup"

If we wanted to type-assert we'd have to solve some circular dependency problems... for now this is ok.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReferenceNotFound

type ReferenceNotFound struct {
	NamespacedName types.NamespacedName
	// contains filtered or unexported fields
}

func NewReferenceNotFoundError

func NewReferenceNotFoundError(name types.NamespacedName, cause error) *ReferenceNotFound

func (*ReferenceNotFound) Cause

func (e *ReferenceNotFound) Cause() error

func (*ReferenceNotFound) Error

func (e *ReferenceNotFound) Error() string

func (*ReferenceNotFound) Format

func (e *ReferenceNotFound) Format(s fmt.State, verb rune)

func (*ReferenceNotFound) Is

func (e *ReferenceNotFound) Is(err error) bool

type Resolver

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

func NewResolver

func NewResolver(client kubeclient.Client, reconciledResourceLookup map[schema.GroupKind]schema.GroupVersionKind) *Resolver

func (*Resolver) ResolveAll

ResolveAll resolves every reference on the provided genruntime.MetaObject. This includes: owner, all resource references, and all secrets.

func (*Resolver) ResolveOwner

func (r *Resolver) ResolveOwner(ctx context.Context, obj genruntime.MetaObject) (genruntime.MetaObject, error)

ResolveOwner returns the MetaObject for the given resources owner. If the resource is supposed to have an owner but doesn't, this returns an ReferenceNotFound error. If the resource is not supposed to have an owner (for example, ResourceGroup), returns nil.

func (*Resolver) ResolveReference

ResolveReference resolves a reference, or returns an error if the reference is not pointing to a KubernetesResource

func (*Resolver) ResolveReferenceToARMID

func (r *Resolver) ResolveReferenceToARMID(ctx context.Context, ref genruntime.NamespacedResourceReference) (string, error)

ResolveReferenceToARMID gets a references ARM ID. If the reference is just pointing to an ARM resource then the ARMID is returned. If the reference is pointing to a Kubernetes resource, that resource is looked up and its ARM ID is computed.

func (*Resolver) ResolveReferencesToARMIDs

func (r *Resolver) ResolveReferencesToARMIDs(ctx context.Context, refs map[genruntime.NamespacedResourceReference]struct{}) (genruntime.ResolvedReferences, error)

ResolveReferencesToARMIDs resolves all provided references to their ARM IDs.

func (*Resolver) ResolveResourceHierarchy

func (r *Resolver) ResolveResourceHierarchy(ctx context.Context, obj genruntime.MetaObject) (ResourceHierarchy, error)

ResolveResourceHierarchy gets the resource hierarchy for a given resource. The result is a slice of resources, with the uppermost parent at position 0 and the resource itself at position len(slice)-1

func (*Resolver) ResolveResourceReferences

func (r *Resolver) ResolveResourceReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.ResolvedReferences, error)

ResolveResourceReferences resolves every reference found on the specified genruntime.MetaObject to its corresponding ARM ID.

func (*Resolver) ResolveResourceSecretReferences

func (r *Resolver) ResolveResourceSecretReferences(ctx context.Context, metaObject genruntime.MetaObject) (genruntime.ResolvedSecrets, error)

ResolveResourceSecretReferences resolves all of the specified genruntime.MetaObject's secret references.

func (*Resolver) ResolveSecretReferences

func (r *Resolver) ResolveSecretReferences(
	ctx context.Context,
	refs map[genruntime.NamespacedSecretReference]struct{}) (genruntime.ResolvedSecrets, error)

ResolveSecretReferences resolves all provided secret references

func (*Resolver) Scheme

func (r *Resolver) Scheme() *runtime.Scheme

Scheme returns the current scheme from our client

type ResourceHierarchy

type ResourceHierarchy []genruntime.MetaObject

func (ResourceHierarchy) AzureName

func (h ResourceHierarchy) AzureName() string

AzureName returns the Azure name for use in creating a resource.

func (ResourceHierarchy) FullyQualifiedARMID

func (h ResourceHierarchy) FullyQualifiedARMID(subscriptionID string) (string, error)

FullyQualifiedARMID returns the fully qualified ARM ID of the resource

func (ResourceHierarchy) Location

func (h ResourceHierarchy) Location() (string, error)

Location returns the location root of the hierarchy, or an error if the root is not a subscription.

func (ResourceHierarchy) ResourceGroup

func (h ResourceHierarchy) ResourceGroup() (string, error)

ResourceGroup returns the resource group that the hierarchy is in, or an error if the hierarchy is not rooted in a resource group.

func (ResourceHierarchy) RootKind

type ResourceHierarchyRoot

type ResourceHierarchyRoot string

type SecretNotFound

type SecretNotFound struct {
	NamespacedName types.NamespacedName
	// contains filtered or unexported fields
}

func NewSecretNotFoundError

func NewSecretNotFoundError(name types.NamespacedName, cause error) *SecretNotFound

func (*SecretNotFound) Cause

func (e *SecretNotFound) Cause() error

func (*SecretNotFound) Error

func (e *SecretNotFound) Error() string

func (*SecretNotFound) Format

func (e *SecretNotFound) Format(s fmt.State, verb rune)

func (*SecretNotFound) Is

func (e *SecretNotFound) Is(err error) bool

type SecretResolver

type SecretResolver interface {
	ResolveSecretReference(ctx context.Context, ref genruntime.NamespacedSecretReference) (string, error)
	ResolveSecretReferences(ctx context.Context, refs map[genruntime.NamespacedSecretReference]struct{}) (genruntime.ResolvedSecrets, error)
}

SecretResolver is a secret resolver

func NewKubeSecretResolver

func NewKubeSecretResolver(client kubeclient.Client) SecretResolver

Jump to

Keyboard shortcuts

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