resources

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopulateRegistryFromFiles

func PopulateRegistryFromFiles(r Registry, files []string) error

PopulateRegistryFromFiles registers resources declared in list of files

Types

type AutogenSpec

type AutogenSpec struct {
	// Deployment Spec is documented in https://github.com/GoogleCloudPlatform/marketplace-tools/docs/autogen-reference.md
	DeploymentSpec map[string]interface{} `yaml:"deploymentSpec"`
	PackageInfo    PackageInfo            `yaml:"packageInfo"`
}

AutogenSpec is defines the spec used for auto-generating deployment packages.

type BaseResource

type BaseResource struct {
	TypeMeta
	Metadata Metadata
}

BaseResource contains fields should be present in all Resources. This struct should be embedded in types implementing the resource interface.

func (*BaseResource) GetDependencies

func (rs *BaseResource) GetDependencies() (r []Reference)

GetDependencies returns the dependencies for the BaseResource

func (*BaseResource) GetReference

func (rs *BaseResource) GetReference() Reference

GetReference computes the reference to the Resource.

type BillingMeteringDriver

type BillingMeteringDriver struct {
	DriverCommand  string         `json:"driverCommand"`
	PlanID         string         `json:"planId"`
	Expectation    Expectation    `json:"expectation"`
	ConnectionInfo ConnectionInfo `json:"connectionInfo"`
}

BillingMeteringDriver is the billing metering driver is executed by the test framework

type BillingMeteringTestConfig

type BillingMeteringTestConfig struct {
	Driver BillingMeteringDriver `json:"driver"`
}

BillingMeteringTestConfig has the parameters that are needed to run the billing metering test

type ConnectionInfo

type ConnectionInfo struct {
	Project   string `json:"project"`
	TableName string `json:"tableName"`
}

ConnectionInfo has the needed information to connect to BigQuery billing export

type CostExpectation

type CostExpectation struct {
	Min      float64 `json:"min"`
	Max      float64 `json:"max"`
	Currency string  `json:"currency"`
}

CostExpectation has metrics that are compared by the metering validator

type DeploymentManagerAutogenTemplate

type DeploymentManagerAutogenTemplate struct {
	BaseResource
	Spec AutogenSpec
	// contains filtered or unexported fields
}

DeploymentManagerAutogenTemplate generates a deployment manager template given an autogen.yaml file.

func (*DeploymentManagerAutogenTemplate) Apply

func (dm *DeploymentManagerAutogenTemplate) Apply(registry Registry, dryRun bool) error

Apply generates a deployment manager template from an autogen file.

func (*DeploymentManagerAutogenTemplate) Test

func (dm *DeploymentManagerAutogenTemplate) Test(registry Registry, dryRun bool) error

Test is a no-op for autogen template resource. Tests are executed on the DeploymentManagerTemplate resource.

type DeploymentManagerTemplate

type DeploymentManagerTemplate struct {
	BaseResource
	DeploymentManagerRef Reference
	// Uploads to gcs if file path prefixed with "gs://". Otherwise will
	// zip to given local file path.
	ZipFilePath string
}

DeploymentManagerTemplate saves a referenced Deployment Manager template to GCS or the local filesystem

func (*DeploymentManagerTemplate) Apply

func (dm *DeploymentManagerTemplate) Apply(registry Registry, dryRun bool) error

Apply uploads a Deployment Manager template to GCS.

func (*DeploymentManagerTemplate) GetDependencies

func (dm *DeploymentManagerTemplate) GetDependencies() (r []Reference)

GetDependencies returns dependencies for DeploymentManagerTemplate

func (*DeploymentManagerTemplate) Test

func (dm *DeploymentManagerTemplate) Test(registry Registry, dryRun bool) error

Test executes Deployment Manager verification tasks such as creating a deployment from the template and deleting a deployment

type Expectation

type Expectation struct {
	SkuID            string           `json:"skuId"`
	UsageExpectation UsageExpectation `json:"usageExpectation"`
	CostExpectation  CostExpectation  `json:"costExpectation"`
}

Expectation outlines the results from running the user provided driver

type GceImage

type GceImage struct {
	BaseResource

	// References another GCE Image resource
	ImageRef Reference

	// References a builder resource which handles the actual creation
	// of the GCE Image
	BuilderRef Reference
	Image      Image
}

GceImage represents a Google Compute Engine image. One of BuilderRef or ImageRef must be specified

func (*GceImage) Apply

func (g *GceImage) Apply(registry Registry, dryRun bool) error

Apply publishes an image to with the project and name specified in the GceImage

func (*GceImage) Test

func (g *GceImage) Test(registry Registry, dryRun bool) error

Test is a no-op for GceImage

type Image

type Image struct {
	ProjectID          string `json:"projectId"`
	NamePartsSeparator string
	NameParts          []string
}

Image defines the location of the GCE Image when published

type Metadata

type Metadata struct {
	Name        string
	Annotations map[string]string
}

Metadata is metadata that all KRM resources must have

type PackageInfo

type PackageInfo struct {
	// Version of combined software components
	Version string
	// Name and version of OS
	OsInfo component `yaml:"osInfo"`
	// Names and versions of software components
	Components []component
}

PackageInfo describes the software packaged in a deployable solution. PackageInfo is metadata displayed on the VM solution details page in the GCP marketplace console.

type PackerGceImageBuilder

type PackerGceImageBuilder struct {
	BaseResource
	Builder struct {
		Script struct {
			File string
		}
	}

	Tests []struct {
		Name   string
		Script struct {
			File string
		}
	}
}

PackerGceImageBuilder uses Packer to create a GCEImage when applied

func (*PackerGceImageBuilder) Apply

func (p *PackerGceImageBuilder) Apply(registry Registry, dryRun bool) error

Apply build a GCE image using Packer

func (*PackerGceImageBuilder) Test

func (p *PackerGceImageBuilder) Test(registry Registry, dryRun bool) error

Test execute tests for GCE Image built from packer

type PartnerIntegrationTestConfig

type PartnerIntegrationTestConfig struct {
	Provider                         string                      `json:"provider"`
	ProductExternalName              string                      `json:"productExternalName"`
	BillingAccount                   string                      `json:"billingAccount"`
	Plans                            []string                    `json:"plans"`
	ApproveEntitlementTimeoutSeconds int32                       `json:"approveEntitlementTimeoutSeconds"`
	ApprovePlanChangeTimeoutSeconds  int32                       `json:"approvePlanChangeTimeoutSeconds"`
	BillingMeteringTestConfig        []BillingMeteringTestConfig `json:"billingMeteringTestConfig"`
}

PartnerIntegrationTestConfig has the parameters that need to go into the test container.

type Reference

type Reference struct {
	Group string
	Kind  string
	Name  string
}

Reference allows a Resource to reference another Resource as part of its specification. The combination of Group, Kind, Name MUST be unique for all applied resources.

type Registry

type Registry interface {
	RegisterResource(resource Resource, workingDirectory string)
	GetExecutor() exec.Interface
	GetResource(reference Reference) Resource
	ResolveFilePath(rs Resource, path string) (string, error)
	Apply(dryRun bool) error
	Test(dryRun bool) error
}

Registry stores references to all resources and can apply all resources in the registry

func NewRegistry

func NewRegistry(executor exec.Interface) Registry

NewRegistry creates a registry that stores references to all resources

type Resource

type Resource interface {
	Apply(registry Registry, dryRun bool) error
	Test(registry Registry, dryRun bool) error
	GetReference() Reference
	GetDependencies() []Reference
}

Resource represents a KRM resource that can be applied

func UnstructuredToResource

func UnstructuredToResource(obj Unstructured) (Resource, error)

UnstructuredToResource converts Unstructured to a specific type implementing the Resource interface, using the TypeMeta from the Unstructured object.

type SaasListingTestTemplate

type SaasListingTestTemplate struct {
	BaseResource
	IntegrationTestConfig PartnerIntegrationTestConfig `yaml:"integrationTestConfig"`
	CredFilePath          string                       `yaml:"credFilePath"`
}

SaasListingTestTemplate has the parameters for a SaasListing integration test.

func (*SaasListingTestTemplate) Apply

func (template *SaasListingTestTemplate) Apply(registry Registry, dryRun bool) error

Apply is a no-op.

func (*SaasListingTestTemplate) Test

func (template *SaasListingTestTemplate) Test(registry Registry, dryRun bool) error

Test takes a SaasListingTestTemplate and starts the partner integration test container.

type TypeMeta

type TypeMeta struct {
	Kind       string
	APIVersion string `yaml:"apiVersion,omitempty"`
}

TypeMeta describes an individual KRM resource with strings representing the type of the object and its API schema version.

type Unstructured

type Unstructured map[string]interface{}

Unstructured is used to unmarshal json/yaml KRM Resources and extract the TypeMeta, such that the KRM Resource can be unmarshalled to a specific type implementing the Resource interface.

type UsageExpectation

type UsageExpectation struct {
	Min       float64 `json:"min"`
	Max       float64 `json:"max"`
	BaseUnits string  `json:"baseUnits"`
}

UsageExpectation has usage metrics that are compared by the metering validator

Jump to

Keyboard shortcuts

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