patterns

package
v0.6.16 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceKW = "$resource"
View Source
const ResourceUpdateThreshold = time.Second * 2

Variables

This section is empty.

Functions

func GetReferenceEntityType

func GetReferenceEntityType(resourcePattern string) (entity, entityType string, err error)

func GetReferenceEntityValue

func GetReferenceEntityValue(resourcePattern string, referred ResourceName) (string, error)

Types

type ApiName

type ApiName struct {
	Name names.Api
}

func (ApiName) Api

func (a ApiName) Api() string

func (ApiName) Artifact

func (a ApiName) Artifact() string

func (ApiName) ParentName

func (a ApiName) ParentName() ResourceName

func (ApiName) Project

func (a ApiName) Project() string

func (ApiName) Spec

func (a ApiName) Spec() string

func (ApiName) String

func (a ApiName) String() string

func (ApiName) Version

func (a ApiName) Version() string

type ApiResource

type ApiResource struct {
	Api *rpc.Api
}

func (ApiResource) ResourceName

func (a ApiResource) ResourceName() ResourceName

func (ApiResource) UpdateTimestamp

func (a ApiResource) UpdateTimestamp() time.Time

type ArtifactName

type ArtifactName struct {
	Name names.Artifact
}

func (ArtifactName) Api

func (ar ArtifactName) Api() string

func (ArtifactName) Artifact

func (ar ArtifactName) Artifact() string

func (ArtifactName) ParentName

func (ar ArtifactName) ParentName() ResourceName

func (ArtifactName) Project

func (ar ArtifactName) Project() string

func (ArtifactName) Spec

func (ar ArtifactName) Spec() string

func (ArtifactName) String

func (ar ArtifactName) String() string

func (ArtifactName) Version

func (ar ArtifactName) Version() string

type ArtifactResource

type ArtifactResource struct {
	Artifact *rpc.Artifact
}

func (ArtifactResource) ResourceName

func (ar ArtifactResource) ResourceName() ResourceName

func (ArtifactResource) UpdateTimestamp

func (ar ArtifactResource) UpdateTimestamp() time.Time

type ProjectName

type ProjectName struct {
	Name names.Project
}

func (ProjectName) Api

func (p ProjectName) Api() string

func (ProjectName) Artifact

func (p ProjectName) Artifact() string

func (ProjectName) ParentName

func (p ProjectName) ParentName() ResourceName

func (ProjectName) Project

func (p ProjectName) Project() string

func (ProjectName) Spec

func (p ProjectName) Spec() string

func (ProjectName) String

func (p ProjectName) String() string

func (ProjectName) Version

func (p ProjectName) Version() string

type ProjectResource

type ProjectResource struct {
	ProjectName string
}

Project is a special resource which is not available through the registry client. Hence we won't store the actual instance of the rpc.Project but instead only store the project name. ProjectResource is mainly used to identify by name when we derive the parents of certain artifacts.

func (ProjectResource) ResourceName

func (p ProjectResource) ResourceName() ResourceName

func (ProjectResource) UpdateTimestamp

func (p ProjectResource) UpdateTimestamp() time.Time

type ResourceInstance

type ResourceInstance interface {
	ResourceName() ResourceName
	UpdateTimestamp() time.Time
}

This interface is used to describe generic resource instances ResourceName is embedded, the only additional field is the UpdateTimestamp

func ListResources added in v0.5.1

func ListResources(ctx context.Context, client connection.RegistryClient, pattern, filter string) ([]ResourceInstance, error)

type ResourceName

type ResourceName interface {
	Artifact() string
	Spec() string
	Version() string
	Api() string
	Project() string
	String() string
	ParentName() ResourceName
}

This interface is used to describe generic resource names Example: projects/demo/locations/global/apis/petstore/versions/1.0.0/specs/openapi projects/demo/locations/global/apis/-/versions/-/specs/-/artifacts/-

func FullResourceNameFromParent

func FullResourceNameFromParent(resourcePattern string, parent string) (ResourceName, error)

func ParseResourcePattern

func ParseResourcePattern(resourcePattern string) (ResourceName, error)

func SubstituteReferenceEntity

func SubstituteReferenceEntity(resourcePattern string, referred ResourceName) (ResourceName, error)

type SpecName

type SpecName struct {
	Name       names.Spec
	RevisionID string
}

func (SpecName) Api

func (s SpecName) Api() string

func (SpecName) Artifact

func (s SpecName) Artifact() string

func (SpecName) ParentName

func (s SpecName) ParentName() ResourceName

func (SpecName) Project

func (s SpecName) Project() string

func (SpecName) Spec

func (s SpecName) Spec() string

func (SpecName) String

func (s SpecName) String() string

func (SpecName) Version

func (s SpecName) Version() string

type SpecResource

type SpecResource struct {
	Spec *rpc.ApiSpec
}

func (SpecResource) ResourceName

func (s SpecResource) ResourceName() ResourceName

func (SpecResource) UpdateTimestamp

func (s SpecResource) UpdateTimestamp() time.Time

type VersionName

type VersionName struct {
	Name names.Version
}

func (VersionName) Api

func (v VersionName) Api() string

func (VersionName) Artifact

func (v VersionName) Artifact() string

func (VersionName) ParentName

func (v VersionName) ParentName() ResourceName

func (VersionName) Project

func (v VersionName) Project() string

func (VersionName) Spec

func (v VersionName) Spec() string

func (VersionName) String

func (v VersionName) String() string

func (VersionName) Version

func (v VersionName) Version() string

type VersionResource

type VersionResource struct {
	Version *rpc.ApiVersion
}

func (VersionResource) ResourceName

func (v VersionResource) ResourceName() ResourceName

func (VersionResource) UpdateTimestamp

func (v VersionResource) UpdateTimestamp() time.Time

Jump to

Keyboard shortcuts

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